[sword-svn] r1715 - in trunk: include lib/bcppmake src/mgr
src/modules src/modules/texts/rawtext src/modules/texts/ztext
tests/bcppmake
scribe at crosswire.org
scribe at crosswire.org
Tue Feb 8 03:06:36 MST 2005
Author: scribe
Date: 2005-02-08 03:06:35 -0700 (Tue, 08 Feb 2005)
New Revision: 1715
Modified:
trunk/include/filemgr.h
trunk/include/rawtext.h
trunk/include/swsearchable.h
trunk/include/ztext.h
trunk/lib/bcppmake/libsword.bpr
trunk/src/mgr/filemgr.cpp
trunk/src/mgr/swsearchable.cpp
trunk/src/modules/swmodule.cpp
trunk/src/modules/texts/rawtext/rawtext.cpp
trunk/src/modules/texts/ztext/ztext.cpp
trunk/tests/bcppmake/filtertest.bpr
trunk/tests/bcppmake/mgrtest.bpr
trunk/tests/bcppmake/parsekey.bpr
Log:
Updates to better support CLucene searching.
Modified: trunk/include/filemgr.h
===================================================================
--- trunk/include/filemgr.h 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/include/filemgr.h 2005-02-08 10:06:35 UTC (rev 1715)
@@ -27,6 +27,7 @@
#include <defs.h>
#include <swbuf.h>
+#include <swcacher.h>
SWORD_NAMESPACE_START
@@ -74,7 +75,7 @@
* It keeps a list of all open files internally and closes them
* when the destructor is called.
*/
-class FileMgr {
+class FileMgr : public SWCacher {
friend class FileDesc;
friend class __staticsystemFileMgr;
@@ -129,6 +130,11 @@
*/
void close(FileDesc * file);
+ /** Cacher methods overridden
+ */
+ virtual void flush();
+ virtual long resourceConsumption();
+
/** Checks for the existence of a file.
* @param ipath Path to file.
* @param ifileName Name of file to check for.
Modified: trunk/include/rawtext.h
===================================================================
--- trunk/include/rawtext.h 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/include/rawtext.h 2005-02-08 10:06:35 UTC (rev 1715)
@@ -44,14 +44,10 @@
class SWDLLEXPORT RawText : public SWText, public RawVerse {
VerseKey &getVerseKey();
-#ifdef USELUCENE
- lucene::index::IndexReader *ir;
- lucene::search::IndexSearcher *is;
-#else
+#ifndef USELUCENE
RawStr *fastSearch[2];
#endif
-
public:
RawText(const char *ipath, const char *iname = 0, const char *idesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
@@ -60,7 +56,10 @@
virtual SWBuf &getRawEntryBuf();
virtual void increment(int steps = 1);
virtual void decrement(int steps = 1) { increment(-steps); }
- virtual signed char createSearchFramework();
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+ virtual void deleteSearchFramework();
virtual bool hasSearchFramework() { return true; }
virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
Modified: trunk/include/swsearchable.h
===================================================================
--- trunk/include/swsearchable.h 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/include/swsearchable.h 2005-02-08 10:06:35 UTC (rev 1715)
@@ -68,12 +68,17 @@
/** ask the object to build any framework it need to do it searching.
*
*/
- virtual signed char createSearchFramework(); // special search framework
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0); // special search framework
+ virtual void deleteSearchFramework();
+
/** does this class have a search framework built?
*
*/
virtual bool hasSearchFramework() { return false; } // special search framework
+
/** Check if the search is optimally supported (e.g. if index files are presnt and working)
* This function checks whether the search framework may work in the best way.
* @return True if the the search is optimally supported, false if it's not working in the best way.
Modified: trunk/include/ztext.h
===================================================================
--- trunk/include/ztext.h 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/include/ztext.h 2005-02-08 10:06:35 UTC (rev 1715)
@@ -49,8 +49,6 @@
VerseKey *lastWriteKey;
bool sameBlock(VerseKey * lastWriteKey, VerseKey * key);
int blockType;
- lucene::index::IndexReader *ir;
- lucene::search::IndexSearcher *is;
VerseKey &getVerseKey();
@@ -76,7 +74,7 @@
virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
- virtual void deleteEntry(); // Delete current module entry
+ virtual void deleteEntry(); // Delete current module entry
// end write interface ------------------------
virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
@@ -85,7 +83,10 @@
virtual void flush() { flushCache(); }
// end swcacher interface ----------------------
- virtual signed char createSearchFramework();
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+ virtual void deleteSearchFramework();
virtual bool hasSearchFramework() { return true; }
virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
Modified: trunk/lib/bcppmake/libsword.bpr
===================================================================
--- trunk/lib/bcppmake/libsword.bpr 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/lib/bcppmake/libsword.bpr 2005-02-08 10:06:35 UTC (rev 1715)
@@ -115,10 +115,10 @@
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<LINKER value="TLib"/>
- <USERDEFINES value="_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG"/>
+ <USERDEFINES value="_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="libsword.bpf"/>
- <INCLUDEPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n"/>
+ <INCLUDEPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n;..\..\..\biblecs\clucene\src"/>
<LIBPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
<LISTFILE value=""/>
@@ -139,7 +139,7 @@
-I$(BCB)\include -I$(BCB)\include\vcl -I..\..\..\icu-sword\source\i18n
-src_suffix cpp -D_ICU_ -D_ICUSWORD_ -DUSBINARY -D_DEBUG
-DU_HAVE_PLACEMENT_NEW=0 -boa"/>
- <CFLAG1 value="-Od -Vx -X- -r- -a8 -b- -k -y -v -vi- -c -tW -tWM"/>
+ <CFLAG1 value="-vGc -vGt -vGd -Od -Vx -X- -r- -a8 -b- -k -y -v -vi- -c -tW -tWM"/>
<PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
<AFLAGS value="/mx /w2 /zi"/>
<LFLAGS value="/P512"/>
@@ -177,23 +177,25 @@
Comments=
[HistoryLists\hlIncludePath]
-Count=16
-Item0=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n
-Item1=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item2=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\include;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item3=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\include;..\..\apps\windoze\CBuilder5\InstallMgr;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item4=..\..\..\icu-sword\include;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item5=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item6=..\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item7=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n
-Item8=..\..\apps\windoze;..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n
-Item9=..\..\apps\windoze;..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n
-Item10=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common
-Item11=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item12=..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item13=..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
-Item14=..\include;$(BCB)\include;$(BCB)\include\vcl
-Item15=..\src\modules\texts\rawtext;..\src\modules\texts;..\src\modules\lexdict\rawld;..\src\modules\lexdict;..\src\modules\filters;..\src\modules\common;..\src\modules\comments\rawfiles;..\src\modules\comments\rawcom;..\src\modules\comments\hrefcom;..\src\modules\comments;..\src\modules;..\src\frontend;..\src\utilfuns;..\src\mgr;..\src\keys;$(BCB)\include;$(BCB)\include\vcl
+Count=18
+Item0=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n;..\..\..\biblecs\clucene\src
+Item1=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n;D:\src\biblecs\clucene\src
+Item2=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n
+Item3=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item4=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\include;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item5=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\include;..\..\apps\windoze\CBuilder5\InstallMgr;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item6=..\..\..\icu-sword\include;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item7=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item8=..\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item9=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n
+Item10=..\..\apps\windoze;..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n
+Item11=..\..\apps\windoze;..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n
+Item12=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common
+Item13=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item14=..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item15=..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item16=..\include;$(BCB)\include;$(BCB)\include\vcl
+Item17=..\src\modules\texts\rawtext;..\src\modules\texts;..\src\modules\lexdict\rawld;..\src\modules\lexdict;..\src\modules\filters;..\src\modules\common;..\src\modules\comments\rawfiles;..\src\modules\comments\rawcom;..\src\modules\comments\hrefcom;..\src\modules\comments;..\src\modules;..\src\frontend;..\src\utilfuns;..\src\mgr;..\src\keys;$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=6
@@ -209,18 +211,20 @@
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
-Count=11
-Item0=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
-Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
-Item2=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
-Item3=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
-Item4=_ICU_;_ICUSWORD_;USBINARY
-Item5=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE;_DEBUG
-Item6=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE
-Item7=;USBINARY;_DEBUG
-Item8=_ICU_;_ICUSWORD_
-Item9=_ICU_;_ICUSWORD_;_DEBUG
-Item10=_DEBUG
+Count=13
+Item0=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
+Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
+Item2=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
+Item3=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
+Item4=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
+Item5=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
+Item6=_ICU_;_ICUSWORD_;USBINARY
+Item7=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE;_DEBUG
+Item8=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE
+Item9=;USBINARY;_DEBUG
+Item10=_ICU_;_ICUSWORD_
+Item11=_ICU_;_ICUSWORD_;_DEBUG
+Item12=_DEBUG
[HistoryLists\hlFinalOutputDir]
Count=3
@@ -249,7 +253,7 @@
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
-LinkCGLIB=0
+LinkCGLIB=1
[Language]
ActiveLang=
Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/src/mgr/filemgr.cpp 2005-02-08 10:06:35 UTC (rev 1715)
@@ -491,4 +491,28 @@
}
+void FileMgr::flush() {
+ FileDesc **loop;
+
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if ((*loop)->fd > 0) {
+ (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
+ ::close((*loop)->fd);
+ (*loop)->fd = -77;
+ }
+ }
+}
+
+long FileMgr::resourceConsumption() {
+ long count = 0;
+ FileDesc **loop;
+ for (loop = &files; *loop; loop = &((*loop)->next)) {
+ if ((*loop)->fd > 0) {
+ count++;
+ }
+ }
+ return count;
+}
+
+
SWORD_NAMESPACE_END
Modified: trunk/src/mgr/swsearchable.cpp
===================================================================
--- trunk/src/mgr/swsearchable.cpp 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/src/mgr/swsearchable.cpp 2005-02-08 10:06:35 UTC (rev 1715)
@@ -34,9 +34,11 @@
}
// special search framework
-signed char SWSearchable::createSearchFramework() {
+signed char SWSearchable::createSearchFramework(void (*percent)(char, void *), void *percentUserData) {
return 0;
}
+void SWSearchable::deleteSearchFramework() {
+}
SWORD_NAMESPACE_END
Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/src/modules/swmodule.cpp 2005-02-08 10:06:35 UTC (rev 1715)
@@ -375,6 +375,13 @@
ListKey &SWModule::search(const char *istr, int searchType, int flags, SWKey *scope, bool *justCheckIfSupported, void (*percent)(char, void *), void *percentUserData) {
+ listkey.ClearList();
+
+ if (justCheckIfSupported) {
+ *justCheckIfSupported = (searchType >= -3);
+ return listkey;
+ }
+
SWKey *savekey = 0;
SWKey *searchkey = 0;
regex_t preg;
@@ -389,7 +396,6 @@
processEntryAttributes(searchType == -3);
- listkey.ClearList();
if (!key->Persist()) {
savekey = CreateKey();
Modified: trunk/src/modules/texts/rawtext/rawtext.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/rawtext.cpp 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/src/modules/texts/rawtext/rawtext.cpp 2005-02-08 10:06:35 UTC (rev 1715)
@@ -50,35 +50,23 @@
RawText::RawText(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang)
: SWText(iname, idesc, idisp, enc, dir, mark, ilang),
- RawVerse(ipath) {
-
-#ifdef USELUCENE
+ RawVerse(ipath) {
+
+#ifndef USELUCENE
SWBuf fname;
fname = path;
- ir = 0;
- is = 0;
char ch = fname.c_str()[strlen(fname.c_str())-1];
if ((ch != '/') && (ch != '\\'))
- fname += "/lucene";
- if (IndexReader::indexExists(fname.c_str())) {
- ir = &IndexReader::open(fname);
- is = new IndexSearcher(*ir);
- }
-#else
- SWBuf fname;
- fname = path;
- char ch = fname.c_str()[strlen(fname.c_str())-1];
- if ((ch != '/') && (ch != '\\'))
fname += "/";
for (int loop = 0; loop < 2; loop++) {
- fastSearch[loop] = 0;
+ fastSearch[loop] = 0;
SWBuf fastidxname =(fname + ((loop)?"ntwords.dat":"otwords.dat"));
if (!access(fastidxname.c_str(), 04)) {
fastidxname = (fname + ((loop)?"ntwords.idx":"otwords.idx"));
if (!access(fastidxname.c_str(), 04))
fastSearch[loop] = new RawStr((fname + ((loop)?"ntwords":"otwords")).c_str());
- }
+ }
}
#endif
}
@@ -89,13 +77,7 @@
*/
RawText::~RawText() {
-#ifdef USELUCENE
- if (is)
- is->close();
-
- if (ir)
- delete ir;
-#else
+#ifndef USELUCENE
if (fastSearch[0])
delete fastSearch[0];
@@ -162,7 +144,7 @@
}
-signed char RawText::createSearchFramework() {
+signed char RawText::createSearchFramework(void (*percent)(char, void *), void *percentUserData) {
#ifdef USELUCENE
SWKey *savekey = 0;
SWKey *searchkey = 0;
@@ -170,7 +152,8 @@
char *word = 0;
char *wordBuf = 0;
-
+ // be sure we give CLucene enough file handles
+ FileMgr::getSystemFileMgr()->flush();
// save key information so as not to disrupt original
// module position
if (!key->Persist()) {
@@ -200,6 +183,7 @@
char ch = target.c_str()[strlen(target.c_str())-1];
if ((ch != '/') && (ch != '\\'))
target += "/lucene";
+ FileMgr::createParent(target+"/dummy");
if (IndexReader::indexExists(target.c_str())) {
d = &FSDirectory::getDirectory(target.c_str(), false);
@@ -214,8 +198,30 @@
}
+ char perc = 1;
+ VerseKey *vkcheck = 0;
+ SWTRY {
+ vkcheck = SWDYNAMIC_CAST(VerseKey, key);
+ }
+ SWCATCH (...) {}
+ long highIndex = (vkcheck)?32300/*vkcheck->NewIndex()*/:key->Index();
+ if (!highIndex)
+ highIndex = 1; // avoid division by zero errors.
while (!Error()) {
+ long mindex = 0;
+ if (vkcheck)
+ mindex = vkcheck->NewIndex();
+ else mindex = key->Index();
+ float per = (float)mindex / highIndex;
+ 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);
+ }
Document &doc = *new Document();
doc.add( Field::Text(_T("key"), (const char *)*lkey ) );
doc.add( Field::Text(_T("content"), StripText()) );
@@ -239,7 +245,6 @@
if (searchkey)
delete searchkey;
-
#else
SWKey *savekey = 0;
SWKey *searchkey = 0;
@@ -370,6 +375,13 @@
return 0;
}
+void RawText::deleteSearchFramework() {
+ SWBuf target = path;
+ char ch = target.c_str()[strlen(target.c_str())-1];
+ if ((ch != '/') && (ch != '\\'))
+ target += "/lucene";
+ FileMgr::removeDir(target.c_str());
+}
/******************************************************************************
* SWModule::search - Searches a module for a string
@@ -390,7 +402,11 @@
#ifdef USELUCENE
listkey.ClearList();
- if ((is) && (ir)) {
+ SWBuf target = path;
+ char ch = target.c_str()[strlen(target.c_str())-1];
+ if ((ch != '/') && (ch != '\\'))
+ target += "/lucene";
+ if (IndexReader::indexExists(target.c_str())) {
switch (searchType) {
case -2: { // let lucene replace multiword for now
@@ -417,6 +433,10 @@
return listkey;
}
+ lucene::index::IndexReader *ir;
+ lucene::search::IndexSearcher *is;
+ ir = &IndexReader::open(target);
+ is = new IndexSearcher(*ir);
(*percent)(10, percentUserData);
standard::StandardAnalyzer analyzer;
@@ -454,6 +474,9 @@
delete &h;
delete &q;
+ delete is;
+ ir->close();
+
listkey = TOP;
(*percent)(100, percentUserData);
return listkey;
Modified: trunk/src/modules/texts/ztext/ztext.cpp
===================================================================
--- trunk/src/modules/texts/ztext/ztext.cpp 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/src/modules/texts/ztext/ztext.cpp 2005-02-08 10:06:35 UTC (rev 1715)
@@ -45,19 +45,6 @@
: zVerse(ipath, -1, iblockType, icomp), SWText(iname, idesc, idisp, enc, dir, mark, ilang) {
blockType = iblockType;
lastWriteKey = 0;
-#ifdef USELUCENE
- SWBuf fname;
- fname = path;
- ir = 0;
- is = 0;
- char ch = fname.c_str()[strlen(fname.c_str())-1];
- if ((ch != '/') && (ch != '\\'))
- fname += "/lucene";
- if (IndexReader::indexExists(fname.c_str())) {
- ir = &IndexReader::open(fname);
- is = new IndexSearcher(*ir);
- }
-#endif
}
@@ -72,13 +59,6 @@
if (lastWriteKey)
delete lastWriteKey;
-#ifdef USELUCENE
- if (is)
- is->close();
-
- if (ir)
- delete ir;
-#endif
}
@@ -253,7 +233,7 @@
#define O_BINARY 0
#endif
-signed char zText::createSearchFramework() {
+signed char zText::createSearchFramework(void (*percent)(char, void *), void *percentUserData) {
#ifdef USELUCENE
SWKey *savekey = 0;
SWKey *searchkey = 0;
@@ -261,6 +241,8 @@
char *word = 0;
char *wordBuf = 0;
+ // be sure we give CLucene enough file handles
+ FileMgr::getSystemFileMgr()->flush();
// save key information so as not to disrupt original
// module position
@@ -283,14 +265,15 @@
// iterate thru each entry in module
- IndexWriter* writer = NULL;
- Directory* d = NULL;
+ IndexWriter *writer = NULL;
+ Directory *d = NULL;
- lucene::analysis::SimpleAnalyzer& an = *new lucene::analysis::SimpleAnalyzer();
+ lucene::analysis::SimpleAnalyzer *an = new lucene::analysis::SimpleAnalyzer();
SWBuf target = path;
char ch = target.c_str()[strlen(target.c_str())-1];
if ((ch != '/') && (ch != '\\'))
target += "/lucene";
+ FileMgr::createParent(target+"/dummy");
if (IndexReader::indexExists(target.c_str())) {
d = &FSDirectory::getDirectory(target.c_str(), false);
@@ -298,20 +281,43 @@
IndexReader::unlock(*d);
}
- writer = new IndexWriter(*d, an, false);
+ writer = new IndexWriter(*d, *an, false);
} else {
d = &FSDirectory::getDirectory(target.c_str(), true);
- writer = new IndexWriter( *d ,an, true);
+ writer = new IndexWriter( *d ,*an, true);
}
+ char perc = 1;
+ VerseKey *vkcheck = 0;
+ SWTRY {
+ vkcheck = SWDYNAMIC_CAST(VerseKey, key);
+ }
+ SWCATCH (...) {}
+ long highIndex = (vkcheck)?32300/*vkcheck->NewIndex()*/:key->Index();
+ if (!highIndex)
+ highIndex = 1; // avoid division by zero errors.
+
while (!Error()) {
- Document &doc = *new Document();
- doc.add( Field::Text(_T("key"), (const char *)*lkey ) );
- doc.add( Field::Text(_T("content"), StripText()) );
- writer->addDocument(doc);
- delete &doc;
+ long mindex = 0;
+ if (vkcheck)
+ mindex = vkcheck->NewIndex();
+ else mindex = key->Index();
+ float per = (float)mindex / highIndex;
+ 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);
+ }
+ Document *doc = new Document();
+ doc->add( Field::Text(_T("key"), (const char *)*lkey ) );
+ doc->add( Field::Text(_T("content"), StripText()) );
+ writer->addDocument(*doc);
+ delete doc;
(*this)++;
}
@@ -319,7 +325,7 @@
writer->optimize();
writer->close();
delete writer;
- delete &an;
+ delete an;
// reposition module back to where it was before we were called
setKey(*savekey);
@@ -330,11 +336,17 @@
if (searchkey)
delete searchkey;
-
#endif
return 0;
}
+void zText::deleteSearchFramework() {
+ SWBuf target = path;
+ char ch = target.c_str()[strlen(target.c_str())-1];
+ if ((ch != '/') && (ch != '\\'))
+ target += "/lucene";
+ FileMgr::removeDir(target.c_str());
+}
/******************************************************************************
* SWModule::Search - Searches a module for a string
@@ -355,7 +367,11 @@
#ifdef USELUCENE
listkey.ClearList();
- if ((is) && (ir)) {
+ SWBuf target = path;
+ char ch = target.c_str()[strlen(target.c_str())-1];
+ if ((ch != '/') && (ch != '\\'))
+ target += "/lucene";
+ if (IndexReader::indexExists(target.c_str())) {
switch (searchType) {
case -2: { // let lucene replace multiword for now
@@ -382,6 +398,10 @@
return listkey;
}
+ lucene::index::IndexReader *ir;
+ lucene::search::IndexSearcher *is;
+ ir = &IndexReader::open(target);
+ is = new IndexSearcher(*ir);
(*percent)(10, percentUserData);
standard::StandardAnalyzer analyzer;
@@ -419,6 +439,9 @@
delete &h;
delete &q;
+ delete is;
+ ir->close();
+
listkey = TOP;
(*percent)(100, percentUserData);
return listkey;
Modified: trunk/tests/bcppmake/filtertest.bpr
===================================================================
--- trunk/tests/bcppmake/filtertest.bpr 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/tests/bcppmake/filtertest.bpr 2005-02-08 10:06:35 UTC (rev 1715)
@@ -27,8 +27,8 @@
<USERDEFINES value="_DEBUG"/>
<SYSDEFINES value="NO_STRICT;_NO_VCL"/>
<MAINSOURCE value="filtertest.bpf"/>
- <INCLUDEPATH value="..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
- <LIBPATH value="..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
</MACROS>
<OPTIONS>
Modified: trunk/tests/bcppmake/mgrtest.bpr
===================================================================
--- trunk/tests/bcppmake/mgrtest.bpr 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/tests/bcppmake/mgrtest.bpr 2005-02-08 10:06:35 UTC (rev 1715)
@@ -27,8 +27,8 @@
<USERDEFINES value="_DEBUG"/>
<SYSDEFINES value="NO_STRICT;_NO_VCL"/>
<MAINSOURCE value="mgrtest.bpf"/>
- <INCLUDEPATH value="..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
- <LIBPATH value="..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
</MACROS>
<OPTIONS>
Modified: trunk/tests/bcppmake/parsekey.bpr
===================================================================
--- trunk/tests/bcppmake/parsekey.bpr 2005-02-07 00:31:09 UTC (rev 1714)
+++ trunk/tests/bcppmake/parsekey.bpr 2005-02-08 10:06:35 UTC (rev 1715)
@@ -27,8 +27,8 @@
<USERDEFINES value="_DEBUG"/>
<SYSDEFINES value="NO_STRICT;_NO_VCL"/>
<MAINSOURCE value="parsekey.bpf"/>
- <INCLUDEPATH value="..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
- <LIBPATH value="..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
</MACROS>
<OPTIONS>
@@ -97,7 +97,7 @@
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
-RunParams="jn1:2,3:4;1jn2:3 2jn;1jn 2:3: yo test"
+RunParams="jn1:2 -3:4"
HostApplication=
RemoteHost=
RemotePath=
More information about the sword-cvs
mailing list