Matthew Talbert wrote: > However, I recommend that you switch to using the SimpleAnalyzer > rather than StandardAnalyzer. All that's needed it to replace > occurrences of standard::StandardAnalyzer to SimpleAnalyzer (no > namespace needed), and remove all references to stop_words. Based on > my experiments, I believe this is the best way to do it.
OK... I tried, and it broke... so now I own all the pieces? There are no references to stop_words in the current svn head (r2449). So, all I did, on a virtual machine which had never had SWORD on it before, was to install the build prerequisites, then grab an svn tree, add my getenv hack to search.cpp, build it, install it, download the KJV, test with diatheke, mkfastmod KJV, test with search, and then: sed -i -e s/standard::Standard/Simple/g src/modules/swmodule.cpp which changes exactly two lines. However, after compiling and installing from the changed svn tree, and doing mkfastmod KJV, running SEARCHTYPE=-4 ./examples/cmdline/search KJV "is" still segfaults :( What am I missing? At least the other way avoids the segfaults. An svn diff is attached. Jonathan
Index: src/modules/swmodule.cpp =================================================================== --- src/modules/swmodule.cpp (revision 2449) +++ src/modules/swmodule.cpp (working copy) @@ -511,7 +511,7 @@ is = new IndexSearcher(ir); (*percent)(10, percentUserData); - standard::StandardAnalyzer analyzer; + SimpleAnalyzer analyzer; lucene_utf8towcs(wcharBuffer, istr, MAX_CONV_SIZE); //TODO Is istr always utf8? q = QueryParser::parse(wcharBuffer, _T("content"), &analyzer); (*percent)(20, percentUserData); @@ -1027,7 +1027,7 @@ IndexWriter *fsWriter = NULL; Directory *d = NULL; - standard::StandardAnalyzer *an = new standard::StandardAnalyzer(); + SimpleAnalyzer *an = new SimpleAnalyzer(); SWBuf target = getConfigEntry("AbsoluteDataPath"); bool includeKeyInSearch = getConfig().has("SearchOption", "IncludeKeyInSearch"); char ch = target.c_str()[strlen(target.c_str())-1]; Index: examples/cmdline/search.cpp =================================================================== --- examples/cmdline/search.cpp (revision 2449) +++ examples/cmdline/search.cpp (working copy) @@ -26,6 +26,7 @@ #include <markupfiltmgr.h> #include <regex.h> // GNU #include <iostream> +#include <cstdlib> // For getenv() and atoi() #ifndef NO_SWORD_NAMESPACE using namespace sword; @@ -72,6 +73,13 @@ exit(-1); } + // Override compiled in SEARCH_TYPE from environment variable. + char *envpointer; + std::string envstring = "SEARCH_TYPE"; + if ((envpointer = getenv(envstring.c_str()))) { + SEARCH_TYPE = atoi(envpointer); + std::cout << "SEARCH_TYPE is : " << envpointer << std::endl ; + } SWBuf searchTerm = argv[2]; manager.setGlobalOption("Greek Accents", "Off");
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page