[sword-svn] r1841 - in trunk: . bindings/corba/java
examples/cmdline src/modules tests
scribe at crosswire.org
scribe at crosswire.org
Tue Jul 5 05:13:34 MST 2005
Author: scribe
Date: 2005-07-05 05:13:34 -0700 (Tue, 05 Jul 2005)
New Revision: 1841
Modified:
trunk/bindings/corba/java/Makefile
trunk/examples/cmdline/search.cpp
trunk/src/modules/swmodule.cpp
trunk/tests/parsekey.cpp
trunk/usrinst.sh
Log:
Fixed lucene range limited searches
Modified: trunk/bindings/corba/java/Makefile
===================================================================
--- trunk/bindings/corba/java/Makefile 2005-06-29 22:31:08 UTC (rev 1840)
+++ trunk/bindings/corba/java/Makefile 2005-07-05 12:13:34 UTC (rev 1841)
@@ -1,5 +1,5 @@
TOMCAT_HOME=/usr/local/tomcat
-instdir=/home/swordweb/livehtml
+instdir=/home/scribe/src/swordweb
all: src/org/crosswire/sword/orb/SWMgr.java classes/org/crosswire/sword/orb/SwordOrb.class
src/org/crosswire/sword/orb/SWMgr.java: ../swordorb.idl
Modified: trunk/examples/cmdline/search.cpp
===================================================================
--- trunk/examples/cmdline/search.cpp 2005-06-29 22:31:08 UTC (rev 1840)
+++ trunk/examples/cmdline/search.cpp 2005-07-05 12:13:34 UTC (rev 1841)
@@ -14,9 +14,9 @@
char maxHashes = *((char *)userData);
while ((((float)percent)/100) * maxHashes > printed) {
- std::cout << "=";
+ std::cerr << "=";
printed++;
- std::cout.flush();
+ std::cerr.flush();
}
/*
std::cout << (int)percent << "% ";
@@ -27,8 +27,8 @@
int main(int argc, char **argv)
{
- SWMgr manager(0, 0, true, new MarkupFilterMgr(FMT_RTF, ENC_RTF));
-// SWMgr manager;
+// SWMgr manager(0, 0, true, new MarkupFilterMgr(FMT_RTF, ENC_RTF));
+ SWMgr manager;
SWModule *target;
ListKey listkey;
ListKey scope;
@@ -59,9 +59,9 @@
target->setKey(scope);
}
- std::cout << "[0=================================50===============================100]\n ";
+ std::cerr << "[0=================================50===============================100]\n ";
char lineLen = 70;
- listkey = target->Search(argv[2], -2, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
+ listkey = target->Search(argv[2], -4, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
std::cout << "\n";
while (!listkey.Error()) {
std::cout << (const char *)listkey << std::endl;
Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp 2005-06-29 22:31:08 UTC (rev 1840)
+++ trunk/src/modules/swmodule.cpp 2005-07-05 12:13:34 UTC (rev 1841)
@@ -457,64 +457,63 @@
#ifdef USELUCENE
if (searchType == -4) { // lucene
- // test to see if our scope for this search is bounded by a
- // VerseKey
- VerseKey *testKeyType = 0, vk;
+ // Make sure our scope for this search is bounded by
+ // something we can test
+ // In the future, add bool SWKey::isValid(const char *tryString);
+ VerseKey vk;
+ bool freeTestKey = false;
+ SWKey *testKey = 0;
SWTRY {
- testKeyType = SWDYNAMIC_CAST(VerseKey, ((scope)?scope:key));
+ testKey = SWDYNAMIC_CAST(VerseKey, ((scope)?scope:key));
+ if (!testKey) {
+ testKey = SWDYNAMIC_CAST(ListKey, ((scope)?scope:key));
+ }
}
SWCATCH ( ... ) {}
- // if we don't have a VerseKey * decendant we can't handle
- // because of scope.
- // In the future, add bool SWKey::isValid(const char *tryString);
- // For now just drop back to multiword unindexed
- if (!testKeyType) {
- searchType = -3;
+ if (!testKey) {
+ testKey = new ListKey();
+ *testKey = vk.ParseVerseList((const char *)((scope)?scope:key), vk, true);
+ freeTestKey = true;
}
- else {
- lucene::index::IndexReader *ir;
- lucene::search::IndexSearcher *is;
- ir = &IndexReader::open(target);
- is = new IndexSearcher(*ir);
- (*percent)(10, percentUserData);
+ lucene::index::IndexReader *ir;
+ lucene::search::IndexSearcher *is;
+ ir = &IndexReader::open(target);
+ is = new IndexSearcher(*ir);
+ (*percent)(10, percentUserData);
- standard::StandardAnalyzer analyzer;
- Query &q = QueryParser::Parse(istr, _T("content"), analyzer);
- (*percent)(20, percentUserData);
- Hits &h = is->search(q);
- (*percent)(80, percentUserData);
+ standard::StandardAnalyzer analyzer;
+ Query &q = QueryParser::Parse(istr, _T("content"), analyzer);
+ (*percent)(20, percentUserData);
+ Hits &h = is->search(q);
+ (*percent)(80, percentUserData);
- // iterate thru each good module position that meets the search
- for (long i = 0; i < h.Length(); i++) {
- Document &doc = h.doc(i);
+ // iterate thru each good module position that meets the search
+ for (long i = 0; i < h.Length(); i++) {
+ Document &doc = h.doc(i);
- // set a temporary verse key to this module position
- vk = doc.get(_T("key"));
+ // set a temporary verse key to this module position
+ vk = doc.get(_T("key"));
- // check scope
- // Try to set our scope key to this verse key
- if (scope) {
- *testKeyType = vk;
+ // check scope
+ // Try to set our scope key to this verse key
+ *testKey = vk;
- // check to see if it set ok and if so, add to our return list
- if (*testKeyType == vk) {
- listkey << (const char *) vk;
- listkey.GetElement()->userData = reinterpret_cast<void *>((int)(h.score(i)*100));
- }
- }
- else {
- listkey << (const char*) vk;
- listkey.GetElement()->userData = reinterpret_cast<void *>((int)(h.score(i)*100));
- }
+ // check to see if it set ok and if so, add to our return list
+ if (*testKey == vk) {
+ listkey << (const char *) vk;
+ listkey.GetElement()->userData = (void *)((int)(h.score(i)*100));
}
- (*percent)(98, percentUserData);
+ }
+ (*percent)(98, percentUserData);
- delete &h;
- delete &q;
+ delete &h;
+ delete &q;
- delete is;
- ir->close();
+ delete is;
+ ir->close();
+ if (freeTestKey) {
+ delete testKey;
}
}
#endif
Modified: trunk/tests/parsekey.cpp
===================================================================
--- trunk/tests/parsekey.cpp 2005-06-29 22:31:08 UTC (rev 1840)
+++ trunk/tests/parsekey.cpp 2005-07-05 12:13:34 UTC (rev 1841)
@@ -24,7 +24,7 @@
ListKey verses = DefaultVSKey.ParseVerseList(argv[1], DefaultVSKey, true);
for (int i = 0; i < verses.Count(); i++) {
- VerseKey *element = dynamic_cast<VerseKey *>(verses.GetElement(i));
+ VerseKey *element = SWDYNAMIC_CAST(VerseKey, verses.GetElement(i));
if (element) {
std::cout << (SWBuf(element->LowerBound()) + " - " + SWBuf(element->UpperBound())).c_str() << "\n";
}
Modified: trunk/usrinst.sh
===================================================================
--- trunk/usrinst.sh 2005-06-29 22:31:08 UTC (rev 1840)
+++ trunk/usrinst.sh 2005-07-05 12:13:34 UTC (rev 1841)
@@ -3,14 +3,14 @@
OPTIONS="--prefix=/usr $OPTIONS"
OPTIONS="--without-conf $OPTIONS"
OPTIONS="--sysconfdir=/etc $OPTIONS"
-#OPTIONS="--with-lucene $OPTIONS"
+OPTIONS="--with-lucene $OPTIONS"
#OPTIONS="--with-icu $OPTIONS"
#OPTIONS="--without-curl $OPTIONS"
#OPTIONS="--enable-tests $OPTIONS"
#OPTIONS="--enable-profile $OPTIONS"
-#OPTIONS="--enable-debug $OPTIONS"
-#OPTIONS="--disable-shared $OPTIONS"
-#OPTIONS="--disable-utilities $OPTIONS"
+OPTIONS="--enable-debug $OPTIONS"
+OPTIONS="--disable-shared $OPTIONS"
+OPTIONS="--disable-utilities $OPTIONS"
CPPFLAGS="$CFLAGS $CPPFLAGS -DUSBINARY" ./configure $OPTIONS $*
More information about the sword-cvs
mailing list