[sword-svn] r2122 - trunk/src/modules

scribe at www.crosswire.org scribe at www.crosswire.org
Sat Nov 24 10:58:09 MST 2007


Author: scribe
Date: 2007-11-24 10:58:08 -0700 (Sat, 24 Nov 2007)
New Revision: 2122

Modified:
   trunk/src/modules/swmodule.cpp
Log:
reworked range enforcement for clucene


Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2007-11-24 16:42:32 UTC (rev 2121)
+++ trunk/src/modules/swmodule.cpp	2007-11-24 17:58:08 UTC (rev 2122)
@@ -486,6 +486,7 @@
 		char utfBuffer[MAX_CONV_SIZE + 1];
 		
 		
+/*
 		// Make sure our scope for this search is bounded by
 		// something we can test
 		// In the future, add bool SWKey::isValid(const char *tryString);
@@ -497,9 +498,9 @@
 		SWKey *testKey = 0;
 		if (enforceRange) {
 			SWTRY {
-				testKey = SWDYNAMIC_CAST(VerseKey, ((scope)?scope:key));
+				testKey = SWDYNAMIC_CAST(VerseKey, getKey());
 				if (!testKey) {
-					testKey = SWDYNAMIC_CAST(ListKey, ((scope)?scope:key));
+					testKey = SWDYNAMIC_CAST(ListKey, getKey());
 				}
 			}
 			SWCATCH ( ... ) {}
@@ -509,6 +510,8 @@
 				freeTestKey = true;
 			}
 		}
+*/
+
 		lucene::index::IndexReader    *ir = 0;
 		lucene::search::IndexSearcher *is = 0;
 		Query                          *q = 0;
@@ -532,21 +535,27 @@
 				// set a temporary verse key to this module position
 				lucene_wcstoutf8(utfBuffer, doc.get(_T("key")), MAX_CONV_SIZE);	
 				*resultKey = utfBuffer; //TODO Does a key always accept utf8?
+/*
 				if (enforceRange) {
 					// check scope
 					// Try to set our scope key to this verse key
 					*testKey = *resultKey;
+*/
+					*getKey() = *resultKey;
 
 					// check to see if it set ok and if so, add to our return list
-					if (*testKey == *resultKey) {
+//					if (*testKey == *resultKey) {
+					if (*getKey() == *resultKey) {
 						listKey << *resultKey;
 						listKey.GetElement()->userData = (void *)((__u32)(h->score(i)*100));
 					}
+/*
 				}
 				else {
 					listKey << *resultKey;
 					listKey.GetElement()->userData = (void *)((__u32)(h->score(i)*100));
 				}
+*/
 			}
 			(*percent)(98, percentUserData);
 		}
@@ -561,9 +570,11 @@
 		if (ir) {
 			ir->close();
 		}
+/*
 		if (freeTestKey) {
 			delete testKey;
 		}
+*/
 	}
 #endif
 




More information about the sword-cvs mailing list