[sword-svn] r1718 - in trunk/src/modules: . filters

scribe at crosswire.org scribe at crosswire.org
Fri Feb 11 12:51:58 MST 2005


Author: scribe
Date: 2005-02-11 12:51:57 -0700 (Fri, 11 Feb 2005)
New Revision: 1718

Modified:
   trunk/src/modules/filters/gbffootnotes.cpp
   trunk/src/modules/filters/gbfheadings.cpp
   trunk/src/modules/filters/gbfmorph.cpp
   trunk/src/modules/filters/gbfredletterwords.cpp
   trunk/src/modules/filters/gbfstrongs.cpp
   trunk/src/modules/filters/osisfootnotes.cpp
   trunk/src/modules/filters/osisheadings.cpp
   trunk/src/modules/filters/osislemma.cpp
   trunk/src/modules/filters/osismorph.cpp
   trunk/src/modules/filters/osisredletterwords.cpp
   trunk/src/modules/filters/osisscripref.cpp
   trunk/src/modules/filters/osisstrongs.cpp
   trunk/src/modules/filters/plainfootnotes.cpp
   trunk/src/modules/filters/thmlfootnotes.cpp
   trunk/src/modules/filters/thmlheadings.cpp
   trunk/src/modules/filters/thmllemma.cpp
   trunk/src/modules/filters/thmlmorph.cpp
   trunk/src/modules/filters/thmlscripref.cpp
   trunk/src/modules/filters/thmlstrongs.cpp
   trunk/src/modules/swmodule.cpp
Log:
Changed first options in filter option value list to "Off" or default
Fixed GBFFootnotes bug
Changed CLucene syntax to match JSword
Added "strong:" option to lucene build
Turned all filters off before indexing (restores settings when done)



Modified: trunk/src/modules/filters/gbffootnotes.cpp
===================================================================
--- trunk/src/modules/filters/gbffootnotes.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/gbffootnotes.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -21,7 +21,7 @@
 const char oName[] = "Footnotes";
 const char oTip[] = "Toggles Footnotes On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 
@@ -77,9 +77,9 @@
 				
 					if((tagText.length() == 1) || !strcmp(module->Name(), "IGNT")) {
 						if (option) { // for ASV marks text in verse then put explanation at end of verse
-							text.append(" <FA>(");
+							text.append(" <FS>(");
 							text.append(tagText);
-							text.append(")<Fr>");
+							text.append(")<Fs>");
 							hide = false;
 							continue;
 						}

Modified: trunk/src/modules/filters/gbfheadings.cpp
===================================================================
--- trunk/src/modules/filters/gbfheadings.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/gbfheadings.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -18,7 +18,7 @@
 const char oName[] = "Headings";
 const char oTip[] = "Toggles Headings On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 GBFHeadings::GBFHeadings() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/gbfmorph.cpp
===================================================================
--- trunk/src/modules/filters/gbfmorph.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/gbfmorph.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -17,7 +17,7 @@
 const char oName[] = "Morphological Tags";
 const char oTip[] = "Toggles Morphological Tags On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 GBFMorph::GBFMorph() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/gbfredletterwords.cpp
===================================================================
--- trunk/src/modules/filters/gbfredletterwords.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/gbfredletterwords.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -19,7 +19,7 @@
 const char oName[] = "Words of Christ in Red";
 const char oTip[] = "Toggles Red Coloring for Words of Christ On and Off if they are marked";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 GBFRedLetterWords::GBFRedLetterWords() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/gbfstrongs.cpp
===================================================================
--- trunk/src/modules/filters/gbfstrongs.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/gbfstrongs.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -19,7 +19,7 @@
 const char oName[] = "Strong's Numbers";
 const char oTip[] = "Toggles Strong's Numbers On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 GBFStrongs::GBFStrongs() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/osisfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/osisfootnotes.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osisfootnotes.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -21,7 +21,7 @@
 const char oName[] = "Footnotes";
 const char oTip[] = "Toggles Footnotes On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 VerseKey parser;

Modified: trunk/src/modules/filters/osisheadings.cpp
===================================================================
--- trunk/src/modules/filters/osisheadings.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osisheadings.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -19,7 +19,7 @@
 const char oName[] = "Headings";
 const char oTip[] = "Toggles Headings On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 OSISHeadings::OSISHeadings() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/osislemma.cpp
===================================================================
--- trunk/src/modules/filters/osislemma.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osislemma.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -18,7 +18,7 @@
 const char oName[] = "Lemmas";
 const char oTip[] = "Toggles Lemmas On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 OSISLemma::OSISLemma() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/osismorph.cpp
===================================================================
--- trunk/src/modules/filters/osismorph.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osismorph.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -18,7 +18,7 @@
 const char oName[] = "Morphological Tags";
 const char oTip[] = "Toggles Morphological Tags On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 OSISMorph::OSISMorph() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/osisredletterwords.cpp
===================================================================
--- trunk/src/modules/filters/osisredletterwords.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osisredletterwords.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -19,7 +19,7 @@
 const char oName[] = "Words of Christ in Red";
 const char oTip[] = "Toggles Red Coloring for Words of Christ On and Off if they are marked";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 OSISRedLetterWords::OSISRedLetterWords() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/osisscripref.cpp
===================================================================
--- trunk/src/modules/filters/osisscripref.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osisscripref.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -19,7 +19,7 @@
 const char oName[] = "Cross-references";
 const char oTip[] = "Toggles Scripture Cross-references On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 OSISScripref::OSISScripref() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/osisstrongs.cpp
===================================================================
--- trunk/src/modules/filters/osisstrongs.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/osisstrongs.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -19,7 +19,7 @@
 const char oName[] = "Strong's Numbers";
 const char oTip[] = "Toggles Strong's Numbers On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 

Modified: trunk/src/modules/filters/plainfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/plainfootnotes.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/plainfootnotes.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -29,7 +29,7 @@
 const char oName[] = "Footnotes";
 const char oTip[] = "Toggles Footnotes On and Off In Bible Texts If They Exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 PLAINFootnotes::PLAINFootnotes() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/thmlfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/thmlfootnotes.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/thmlfootnotes.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -21,7 +21,7 @@
 const char oName[] = "Footnotes";
 const char oTip[] = "Toggles Footnotes On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 ThMLFootnotes::ThMLFootnotes() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/thmlheadings.cpp
===================================================================
--- trunk/src/modules/filters/thmlheadings.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/thmlheadings.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -22,7 +22,7 @@
 const char oName[] = "Headings";
 const char oTip[] = "Toggles Headings On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 ThMLHeadings::ThMLHeadings() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/thmllemma.cpp
===================================================================
--- trunk/src/modules/filters/thmllemma.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/thmllemma.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -17,7 +17,7 @@
 const char oName[] = "Lemmas";
 const char oTip[] = "Toggles Lemmas On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 ThMLLemma::ThMLLemma() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/thmlmorph.cpp
===================================================================
--- trunk/src/modules/filters/thmlmorph.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/thmlmorph.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -17,7 +17,7 @@
 const char oName[] = "Morphological Tags";
 const char oTip[] = "Toggles Morphological Tags On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 ThMLMorph::ThMLMorph() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/thmlscripref.cpp
===================================================================
--- trunk/src/modules/filters/thmlscripref.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/thmlscripref.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -20,7 +20,7 @@
 const char oName[] = "Cross-references";
 const char oTip[] = "Toggles Scripture Cross-references On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 ThMLScripref::ThMLScripref() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/filters/thmlstrongs.cpp
===================================================================
--- trunk/src/modules/filters/thmlstrongs.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/filters/thmlstrongs.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -20,7 +20,7 @@
 const char oName[] = "Strong's Numbers";
 const char oTip[] = "Toggles Strong's Numbers On and Off if they exist";
 
-const SWBuf choices[3] = {"On", "Off", ""};
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
 ThMLStrongs::ThMLStrongs() : SWOptionFilter(oName, oTip, &oValues) {

Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2005-02-10 14:44:58 UTC (rev 1717)
+++ trunk/src/modules/swmodule.cpp	2005-02-11 19:51:57 UTC (rev 1718)
@@ -861,6 +861,15 @@
 	char *word = 0;
 	char *wordBuf = 0;
 
+
+	// turn all filters to default values
+	StringList filterSettings;
+	for (FilterList::iterator filter = optionFilters->begin(); filter != optionFilters->end(); filter++) {
+		filterSettings.push_back((*filter)->getOptionValue());
+		(*filter)->setOptionValue(*((*filter)->getOptionValues().begin()));
+	}
+
+	
 	// be sure we give CLucene enough file handles	
 	FileMgr::getSystemFileMgr()->flush();
 
@@ -886,7 +895,7 @@
 	IndexWriter *writer = NULL;
 	Directory *d = NULL;
  
-	lucene::analysis::SimpleAnalyzer *an = new lucene::analysis::SimpleAnalyzer();
+	standard::StandardAnalyzer *an = new standard::StandardAnalyzer();
 	SWBuf target = getConfigEntry("AbsoluteDataPath");
 	char ch = target.c_str()[strlen(target.c_str())-1];
 	if ((ch != '/') && (ch != '\\'))
@@ -918,25 +927,59 @@
 	if (!highIndex)
 		highIndex = 1;		// avoid division by zero errors.
 
+	bool savePEA = isProcessEntryAttributes();
+	processEntryAttributes(true);
+
 	while (!Error()) {
 		long mindex = 0;
 		if (vkcheck)
 			mindex = vkcheck->NewIndex();
 		else mindex = key->Index();
+
+		// computer percent complete so we can report to our progress callback
 		float per = (float)mindex / highIndex;
-		per *= 93;
-		per += 5;
+		// between 5%-98%
+		per *= 93; per += 5;
 		char newperc = (char)per;
-//		char newperc = (char)(5+(93*(((float)((vkcheck)?vkcheck->NewIndex():key->Index()))/highIndex)));
 		if (newperc > perc) {
 			perc = newperc;
 			(*percent)(perc, percentUserData);
 		}
-		const char *stripText = StripText();
-		if (stripText && *stripText) {
+
+		// get "content" field
+		const char *content = StripText();
+
+		if (content && *content) {
+
+			// build "strong" field
+			SWBuf strong;
+		
+			AttributeTypeList::iterator words;
+			AttributeList::iterator word;
+			AttributeValue::iterator strongVal;
+
+			words = getEntryAttributes().find("Word");
+			if (words != getEntryAttributes().end()) {
+				for (word = words->second.begin();word != words->second.end(); word++) {
+					strongVal = word->second.find("Strongs");
+					if (strongVal != word->second.end()) {
+						// cheeze.  skip empty article tags that weren't assigned to any text
+						if (strongVal->second == "G3588") {
+							if (word->second.find("Text") == word->second.end())
+								continue;	// no text? let's skip
+						}
+						strong.append(strongVal->second);
+						strong.append(' ');
+					}
+				}
+			}
+
+			// add our entry to the clucene index		
 			Document *doc = new Document();
-			doc->add( Field::Text(_T("key"), getKeyText() ) );
-			doc->add( Field::Text(_T("content"), stripText) );
+			doc->add( Field::UnIndexed(_T("key"), getKeyText() ) );
+			doc->add( Field::UnStored(_T("content"), content) );
+			if (strong.length() > 0)
+				doc->add( Field::UnStored(_T("strong"), strong) );
 			writer->addDocument(*doc);
 			delete doc;
 		}
@@ -958,6 +1001,14 @@
 	if (searchkey)
 		delete searchkey;
 
+	processEntryAttributes(savePEA);
+
+	// reset option filters back to original values
+	StringList::iterator origVal = filterSettings.begin();
+	for (FilterList::iterator filter = optionFilters->begin(); filter != optionFilters->end(); filter++) {
+		(*filter)->setOptionValue(*origVal++);
+	}
+
 	return 0;
 }
 #endif



More information about the sword-cvs mailing list