[sword-svn] r1725 - in trunk: . bindings/corba
bindings/corba/java/src/org/crosswire/sword/orb
bindings/corba/orbitcpp examples/cmdline utilities
scribe at crosswire.org
scribe at crosswire.org
Mon Feb 21 18:58:30 MST 2005
Author: scribe
Date: 2005-02-21 18:58:29 -0700 (Mon, 21 Feb 2005)
New Revision: 1725
Modified:
trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java
trunk/bindings/corba/orbitcpp/swordorb-impl.cpp
trunk/bindings/corba/orbitcpp/swordorb-impl.hpp
trunk/bindings/corba/orbitcpp/testclient.cpp
trunk/bindings/corba/swordorb.idl
trunk/examples/cmdline/search.cpp
trunk/usrinst.sh
trunk/utilities/mkfastmod.cpp
Log:
Updated to make search index support available via CORBA
Added status hash marks to mkfastmod while building an index
Modified: trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java
===================================================================
--- trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java 2005-02-22 01:58:29 UTC (rev 1725)
@@ -128,14 +128,17 @@
ModInfo[] modInfoList = mgr.getModInfoList();
System.out.println("sequence size: " + modInfoList.length);
SWModule module;
+/*
for (int i = 0; i < modInfoList.length; i++) {
System.out.println(modInfoList[i].name + ": " + modInfoList[i].category + ": " + modInfoList[i].language);
module = mgr.getModuleByName(modInfoList[i].name);
module.setKeyText("jas1:19");
System.out.println(module.getRenderText());
}
- module = mgr.getModuleByName("WEB");
- SearchHit[] searchResults = module.search("God love world", SearchType.MULTIWORD, 0, "");
+*/
+ module = mgr.getModuleByName("KJV");
+ boolean lucene = module.hasSearchFramework();
+ SearchHit[] searchResults = module.search("God love world", (lucene)?SearchType.LUCENE:SearchType.MULTIWORD, 0, "");
for (int i = 0; i < searchResults.length; i++)
System.out.println(searchResults[i].key);
Modified: trunk/bindings/corba/orbitcpp/swordorb-impl.cpp
===================================================================
--- trunk/bindings/corba/orbitcpp/swordorb-impl.cpp 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/bindings/corba/orbitcpp/swordorb-impl.cpp 2005-02-22 01:58:29 UTC (rev 1725)
@@ -122,6 +122,8 @@
if (searchType == REGEX) stype = 0;
if (searchType == PHRASE) stype = -1;
if (searchType == MULTIWORD) stype = -2;
+ if (searchType == ENTRYATTR) stype = -3;
+ if (searchType == LUCENE) stype = -4;
sword::ListKey result;
if ((scope) && (strlen(scope)) > 0) {
@@ -145,7 +147,6 @@
}
-
StringList *SWModule_impl::getEntryAttribute(const char *level1, const char *level2, const char *level3) throw(CORBA::SystemException) {
delegate->RenderText(); // force parse
sword::AttributeTypeList &entryAttribs = delegate->getEntryAttributes();
Modified: trunk/bindings/corba/orbitcpp/swordorb-impl.hpp
===================================================================
--- trunk/bindings/corba/orbitcpp/swordorb-impl.hpp 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/bindings/corba/orbitcpp/swordorb-impl.hpp 2005-02-22 01:58:29 UTC (rev 1725)
@@ -36,6 +36,8 @@
StringList *getEntryAttribute(const char *level1, const char *level2, const char *level3) throw(CORBA::SystemException);
char *getRenderText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->RenderText()); }
char *getConfigEntry(const char *key) throw(CORBA::SystemException) { return CORBA::string_dup(((char *)delegate->getConfigEntry(key)) ? (char *)delegate->getConfigEntry(key):SWNULL); }
+ void deleteSearchFramework() throw(CORBA::SystemException) { return delegate->deleteSearchFramework(); }
+ CORBA::Boolean hasSearchFramework() throw(CORBA::SystemException) { return (delegate->hasSearchFramework() && delegate->isSearchOptimallySupported("God", -4, 0, 0)); }
};
Modified: trunk/bindings/corba/orbitcpp/testclient.cpp
===================================================================
--- trunk/bindings/corba/orbitcpp/testclient.cpp 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/bindings/corba/orbitcpp/testclient.cpp 2005-02-22 01:58:29 UTC (rev 1725)
@@ -32,6 +32,7 @@
std::cout << "ConfigPath: " << mgr->getConfigPath() << "\n";
modInfoList = mgr->getModInfoList();
std::cout << "sequence length: " << modInfoList->length() << "\n";
+/*
for (int i = 0; i < modInfoList->length(); i++) {
std::cout << (*modInfoList)[i].name << ": " << (*modInfoList)[i].category << ": " << (*modInfoList)[i].language << "\n";
if (!strncmp((*modInfoList)[i].category, "Bibl", 4)) {
@@ -41,13 +42,14 @@
}
std::cout << "\n";
}
- /*
+*/
swordorb::SearchHitList *searchResults;
- searchResults = module->search("God love world", swordorb::MULTIWORD, 0, "");
+ module = mgr->getModuleByName("KJV");
+ bool lucene = module->hasSearchFramework();
+ searchResults = module->search("God love world", (lucene)?swordorb::LUCENE:swordorb::MULTIWORD, 0, "");
for (int i = 0; i < searchResults->length(); i++) {
std::cout << (*searchResults)[i].key << "\n";
}
- */
Modified: trunk/bindings/corba/swordorb.idl
===================================================================
--- trunk/bindings/corba/swordorb.idl 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/bindings/corba/swordorb.idl 2005-02-22 01:58:29 UTC (rev 1725)
@@ -31,7 +31,9 @@
enum SearchType {
REGEX,
PHRASE,
- MULTIWORD
+ MULTIWORD,
+ ENTRYATTR,
+ LUCENE
};
@@ -53,6 +55,8 @@
string getStripText();
string getRenderText();
string getConfigEntry(in string key);
+ void deleteSearchFramework();
+ boolean hasSearchFramework();
};
Modified: trunk/examples/cmdline/search.cpp
===================================================================
--- trunk/examples/cmdline/search.cpp 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/examples/cmdline/search.cpp 2005-02-22 01:58:29 UTC (rev 1725)
@@ -59,7 +59,7 @@
std::cout << "[0=================================50===============================100]\n ";
char lineLen = 70;
- listkey = target->Search(argv[2], -3, SEARCHFLAG_MATCHWHOLEENTRY/*REG_ICASE*/, 0, 0, &percentUpdate, &lineLen);
+ listkey = target->Search(argv[2], -2, SEARCHFLAG_MATCHWHOLEENTRY/*REG_ICASE*/, 0, 0, &percentUpdate, &lineLen);
std::cout << "\n";
while (!listkey.Error()) {
std::cout << (const char *)listkey << std::endl;
Modified: trunk/usrinst.sh
===================================================================
--- trunk/usrinst.sh 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/usrinst.sh 2005-02-22 01:58:29 UTC (rev 1725)
@@ -6,9 +6,9 @@
OPTIONS="--sysconfdir=/etc $OPTIONS"
OPTIONS="--with-icu $OPTIONS"
#OPTIONS="--with-vcl $OPTIONS"
-OPTIONS="--enable-debug $OPTIONS"
+#OPTIONS="--enable-debug $OPTIONS"
#OPTIONS="--enable-profile $OPTIONS"
-#OPTIONS="--with-lucene $OPTIONS"
+OPTIONS="--with-lucene $OPTIONS"
#OPTIONS="--without-curl $OPTIONS"
#OPTIONS="--enable-tests $OPTIONS"
Modified: trunk/utilities/mkfastmod.cpp
===================================================================
--- trunk/utilities/mkfastmod.cpp 2005-02-21 23:12:34 UTC (rev 1724)
+++ trunk/utilities/mkfastmod.cpp 2005-02-22 01:58:29 UTC (rev 1725)
@@ -12,6 +12,22 @@
using sword::SWBuf;
#endif
+void percentUpdate(char percent, void *userData) {
+ static char printed = 0;
+ char maxHashes = *((char *)userData);
+
+ while ((((float)percent)/100) * maxHashes > printed) {
+ printf("=");
+ printed++;
+ fflush(stdout);
+ }
+/*
+ std::cout << (int)percent << "% ";
+*/
+ fflush(stdout);
+}
+
+
int main(int argc, char **argv)
{
SWMgr manager(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16));
@@ -45,8 +61,11 @@
exit(-2);
}
+ printf("Deleting any existing framework...\n");
+ target->deleteSearchFramework();
printf("Building framework, please wait...\n");
- char error = target->createSearchFramework();
+ char lineLen = 70;
+ char error = target->createSearchFramework(&percentUpdate, &lineLen);
if (error) {
fprintf(stderr, "%s: couldn't create search framework (permissions?)\n", *argv);
}
More information about the sword-cvs
mailing list