You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(25) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(125) |
Feb
(23) |
Mar
(167) |
Apr
(2) |
May
|
Jun
(19) |
Jul
(304) |
Aug
(181) |
Sep
(189) |
Oct
(145) |
Nov
(110) |
Dec
(44) |
| 2006 |
Jan
(303) |
Feb
(40) |
Mar
(2) |
Apr
(143) |
May
|
Jun
(74) |
Jul
(31) |
Aug
(7) |
Sep
(21) |
Oct
(33) |
Nov
(102) |
Dec
(36) |
| 2007 |
Jan
|
Feb
(16) |
Mar
(38) |
Apr
(34) |
May
(3) |
Jun
(4) |
Jul
(4) |
Aug
(13) |
Sep
(5) |
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
(2) |
Feb
|
Mar
(13) |
Apr
|
May
(18) |
Jun
(48) |
Jul
(136) |
Aug
(45) |
Sep
(21) |
Oct
(32) |
Nov
|
Dec
(9) |
| 2009 |
Jan
(4) |
Feb
|
Mar
(33) |
Apr
(23) |
May
(6) |
Jun
(3) |
Jul
(11) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ust...@us...> - 2009-03-29 08:30:36
|
Revision: 2956
http://clucene.svn.sourceforge.net/clucene/?rev=2956&view=rev
Author: ustramooner
Date: 2009-03-29 08:30:19 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
fix for bug 1948533. was already fixed in branch
Modified Paths:
--------------
trunk/test/testall.cpp
Modified: trunk/test/testall.cpp
===================================================================
--- trunk/test/testall.cpp 2009-03-29 08:19:04 UTC (rev 2955)
+++ trunk/test/testall.cpp 2009-03-29 08:30:19 UTC (rev 2956)
@@ -177,7 +177,7 @@
_tprintf(_T("%s\n"), output->buffer);
if ( times )
- printf("Tests run in %dms\n\n",CL_NS(util)::Misc::currentTimeMillis()-startTime);
+ printf("Tests run in %dms\n\n",(int32_t)(CL_NS(util)::Misc::currentTimeMillis()-startTime));
CuSuiteListDelete(alltests);
CuStringFree(output);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2009-03-29 08:19:07
|
Revision: 2955
http://clucene.svn.sourceforge.net/clucene/?rev=2955&view=rev
Author: ustramooner
Date: 2009-03-29 08:19:04 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
fix for 2656772
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/index/Term.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/index/Term.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/Term.cpp 2009-03-29 08:18:41 UTC (rev 2954)
+++ branches/lucene2_3_2/src/core/CLucene/index/Term.cpp 2009-03-29 08:19:04 UTC (rev 2955)
@@ -220,8 +220,14 @@
if ( _field == other->_field ){ // fields are interned
//Compare text with text of other and return the result
return _tcscmp(_text,other->_text);
- }else
- return _tcscmp(_field,other->_field);
+ }else{
+ int32_t ret = _tcscmp(_field,other->_field);
+ if ( ret == 0 ){
+ return _tcscmp(_text,other->_text);
+ }else{
+ return ret;
+ }
+ }
}
int32_t Term::hashedCompareTo(Term* other) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2009-03-29 08:18:50
|
Revision: 2954
http://clucene.svn.sourceforge.net/clucene/?rev=2954&view=rev
Author: ustramooner
Date: 2009-03-29 08:18:41 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
fix for 2656772
Modified Paths:
--------------
trunk/src/CLucene/index/Term.cpp
Modified: trunk/src/CLucene/index/Term.cpp
===================================================================
--- trunk/src/CLucene/index/Term.cpp 2009-03-29 08:17:42 UTC (rev 2953)
+++ trunk/src/CLucene/index/Term.cpp 2009-03-29 08:18:41 UTC (rev 2954)
@@ -223,11 +223,17 @@
// if this term belongs after the argument.
//Check ret to see if text needs to be compared
- if ( _field == other->_field ){ // fields are interned
- //Compare text with text of other and return the result
- return _tcscmp(_text,other->_text);
- }else
- return _tcscmp(_field,other->_field);
+ if ( _field == other->_field ){ // fields are interned
+ //Compare text with text of other and return the result
+ return _tcscmp(_text,other->_text);
+ }else{
+ int32_t ret = _tcscmp(_field,other->_field);
+ if ( ret == 0 ){
+ return _tcscmp(_text,other->_text);
+ }else{
+ return ret;
+ }
+ }
}
TCHAR* Term::toString() const{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2009-03-29 08:17:52
|
Revision: 2953
http://clucene.svn.sourceforge.net/clucene/?rev=2953&view=rev
Author: ustramooner
Date: 2009-03-29 08:17:42 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
patch for bug 2565185
Modified Paths:
--------------
trunk/src/CLucene/index/SegmentTermDocs.cpp
Modified: trunk/src/CLucene/index/SegmentTermDocs.cpp
===================================================================
--- trunk/src/CLucene/index/SegmentTermDocs.cpp 2009-03-29 08:17:36 UTC (rev 2952)
+++ trunk/src/CLucene/index/SegmentTermDocs.cpp 2009-03-29 08:17:42 UTC (rev 2953)
@@ -125,7 +125,7 @@
_freq = freqStream->readVInt(); // else read _freq
count++;
- if ( (deletedDocs == NULL) || (deletedDocs->get(_doc) == false ) )
+ if ( (deletedDocs == NULL) || (_doc >= 0 && deletedDocs->get(_doc) == false ) )
break;
skippingDoc();
}
@@ -145,7 +145,7 @@
_freq = freqStream->readVInt(); // else read _freq
count++;
- if (deletedDocs == NULL || !deletedDocs->get(_doc)) {
+ if (deletedDocs == NULL || (_doc >= 0 && !deletedDocs->get(_doc))) {
docs[i] = _doc;
freqs[i] = _freq;
i++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2009-03-29 08:17:46
|
Revision: 2952
http://clucene.svn.sourceforge.net/clucene/?rev=2952&view=rev
Author: ustramooner
Date: 2009-03-29 08:17:36 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
patch for bug 2565185
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/index/SegmentTermDocs.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/index/SegmentTermDocs.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/SegmentTermDocs.cpp 2009-03-15 13:02:46 UTC (rev 2951)
+++ branches/lucene2_3_2/src/core/CLucene/index/SegmentTermDocs.cpp 2009-03-29 08:17:36 UTC (rev 2952)
@@ -124,7 +124,7 @@
_freq = freqStream->readVInt(); // else read _freq
count++;
- if ( (deletedDocs == NULL) || (deletedDocs->get(_doc) == false ) )
+ if ( (deletedDocs == NULL) || (_doc >= 0 && deletedDocs->get(_doc) == false ) )
break;
skippingDoc();
}
@@ -144,7 +144,7 @@
_freq = freqStream->readVInt(); // else read _freq
count++;
- if (deletedDocs == NULL || !deletedDocs->get(_doc)) {
+ if (deletedDocs == NULL || (_doc >= 0 && !deletedDocs->get(_doc))) {
docs[i] = _doc;
freqs[i] = _freq;
i++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2009-03-15 13:03:09
|
Revision: 2951
http://clucene.svn.sourceforge.net/clucene/?rev=2951&view=rev
Author: ustramooner
Date: 2009-03-15 13:02:46 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
patch 2494318
Modified Paths:
--------------
trunk/src/CLucene/util/bufferedstream.h
Modified: trunk/src/CLucene/util/bufferedstream.h
===================================================================
--- trunk/src/CLucene/util/bufferedstream.h 2009-03-15 12:54:09 UTC (rev 2950)
+++ trunk/src/CLucene/util/bufferedstream.h 2009-03-15 13:02:46 UTC (rev 2951)
@@ -29,6 +29,7 @@
#include "streambase.h"
#include "inputstreambuffer.h"
#include <cassert>
+#include <stdio.h>
namespace jstreams {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2009-03-15 12:54:22
|
Revision: 2950
http://clucene.svn.sourceforge.net/clucene/?rev=2950&view=rev
Author: ustramooner
Date: 2009-03-15 12:54:09 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
fix 2508277. autogen.sh script doesn't work on Mac OS X
Modified Paths:
--------------
trunk/autogen.sh
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2009-01-10 17:17:55 UTC (rev 2949)
+++ trunk/autogen.sh 2009-03-15 12:54:09 UTC (rev 2950)
@@ -36,7 +36,7 @@
DIE=1
}
-(libtool --version) < /dev/null > /dev/null 2>&1 || {
+(libtool --help) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed to call autogen.sh."
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Rakesh S. <sr...@ho...> - 2009-03-13 22:40:28
|
My apologies. Please ignore. thanks From: sr...@ho... To: clu...@li... Subject: CLucene Demo Program : Weird Hits Score Value Date: Fri, 13 Mar 2009 22:38:56 +0000 Hi - I downloaded the CLucene tar file "clucene-core-0.9.21b.zip" (clucene-core-stable, 0.9.21b) and installed it. Then I ran the demo program cl_demo (under src) with some sample files. The indexing was fine. On searching for "diabetes", it prints the correct documents but a weird output for the hits score value (which is float). For example, I get:- -9223372036854775808.-922337203685477580 Complete output is shown below. Any help as to what may be wrong? I use Fedora Core 4. Thanks in advance Rakesh Statistics for xxxxxxx ================================== Max Docs: 454 Num Docs: 454 Current Version: 1236982290457 Term count: 10856 Enter query string: Diabetes Searching for: diabetes 0. /tmp/hlchtml/hlc-08-000116.toc.txt - [0.0] 1. /tmp/hlchtml/hlc-08-000116.htm - [-9223372036854775808.-922337203685477580] 2. /tmp/hlchtml/hlc-08-000116.debug.html - [0.0] 3. /tmp/hlchtml/hlc-08-000140.htm - [0.0] 4. /tmp/hlchtml/hlc-08-000086.htm - [0.0] 5. /tmp/hlchtml/hlc-08-000083.htm - [0.0] 6. /tmp/hlchtml/hlc-08-000119.htm - [-9223372036854775808.-922337203685477580] 7. /tmp/hlchtml/hlc-08-000136.htm - [-9223372036854775808.-922337203685477580] 8. /tmp/hlchtml/hlc-08-000140.debug.html - [-9223372036854775808.-922337203685477580] 9. /tmp/hlchtml/hlc-08-000146.htm - [0.0] 10. /tmp/hlchtml/hlc-08-000049.htm - [0.0] 11. /tmp/hlchtml/hlc-08-000027.htm - [0.0] 12. /tmp/hlchtml/hlc-08-000020.htm - [0.0] 13. /tmp/hlchtml/hlc-08-000036.htm - [0.0] 14. /tmp/hlchtml/hlc-08-000048.htm - [0.0] 15. /tmp/hlchtml/hlc-08-000083.debug.html - [0.0] 16. /tmp/hlchtml/hlc-08-000086.debug.html - [0.0] 17. /tmp/hlchtml/hlc-08-000146.debug.html - [0.0] 18. /tmp/hlchtml/hlc-08-000143.htm - [0.0] 19. /tmp/hlchtml/hlc-08-000020.debug.html - [-9223372036854775808.-922337203685477580] 20. /tmp/hlchtml/hlc-08-000048.debug.html - [-9223372036854775808.-922337203685477580] 21. /tmp/hlchtml/hlc-08-000149.htm - [-9223372036854775808.-922337203685477580] 22. /tmp/hlchtml/hlc-08-000112.htm - [-9223372036854775808.-922337203685477580] 23. /tmp/hlchtml/hlc-08-000143.debug.html - [-9223372036854775808.-922337203685477580] 24. /tmp/hlchtml/hlc-08-000119.debug.html - [-9223372036854775808.-922337203685477580] 25. /tmp/hlchtml/hlc-08-000136.debug.html - [-43116199.96836142] 26. /tmp/hlchtml/hlc-08-000027.debug.html - [0.0] 27. /tmp/hlchtml/hlc-08-000149.debug.html - [0.0] 28. /tmp/hlchtml/hlc-08-000049.debug.html - [0.0] 29. /tmp/hlchtml/hlc-08-000036.debug.html - [0.0] 30. /tmp/hlchtml/hlc-08-000112.debug.html - [0.0] 31. /tmp/hlchtml/hlc-08-000081.debug.html - [0.0] 32. /tmp/hlchtml/hlc-08-000047.debug.html - [-43116199.96836142] 33. /tmp/hlchtml/hlc-08-000015.debug.html - [-43116199.96836142] 34. /tmp/hlchtml/hlc-08-000029.debug.html - [-43116199.96836142] Search took: 1 ms. Screen dump took: 64 ms. Windows Live™: Keep your life in sync. Check it out. _________________________________________________________________ Windows Live™: Life without walls. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009 |
|
From: Rakesh S. <sr...@ho...> - 2009-03-13 22:39:07
|
Hi - I downloaded the CLucene tar file "clucene-core-0.9.21b.zip" (clucene-core-stable, 0.9.21b) and installed it. Then I ran the demo program cl_demo (under src) with some sample files. The indexing was fine. On searching for "diabetes", it prints the correct documents but a weird output for the hits score value (which is float). For example, I get:- -9223372036854775808.-922337203685477580 Complete output is shown below. Any help as to what may be wrong? I use Fedora Core 4. Thanks in advance Rakesh Statistics for xxxxxxx ================================== Max Docs: 454 Num Docs: 454 Current Version: 1236982290457 Term count: 10856 Enter query string: Diabetes Searching for: diabetes 0. /tmp/hlchtml/hlc-08-000116.toc.txt - [0.0] 1. /tmp/hlchtml/hlc-08-000116.htm - [-9223372036854775808.-922337203685477580] 2. /tmp/hlchtml/hlc-08-000116.debug.html - [0.0] 3. /tmp/hlchtml/hlc-08-000140.htm - [0.0] 4. /tmp/hlchtml/hlc-08-000086.htm - [0.0] 5. /tmp/hlchtml/hlc-08-000083.htm - [0.0] 6. /tmp/hlchtml/hlc-08-000119.htm - [-9223372036854775808.-922337203685477580] 7. /tmp/hlchtml/hlc-08-000136.htm - [-9223372036854775808.-922337203685477580] 8. /tmp/hlchtml/hlc-08-000140.debug.html - [-9223372036854775808.-922337203685477580] 9. /tmp/hlchtml/hlc-08-000146.htm - [0.0] 10. /tmp/hlchtml/hlc-08-000049.htm - [0.0] 11. /tmp/hlchtml/hlc-08-000027.htm - [0.0] 12. /tmp/hlchtml/hlc-08-000020.htm - [0.0] 13. /tmp/hlchtml/hlc-08-000036.htm - [0.0] 14. /tmp/hlchtml/hlc-08-000048.htm - [0.0] 15. /tmp/hlchtml/hlc-08-000083.debug.html - [0.0] 16. /tmp/hlchtml/hlc-08-000086.debug.html - [0.0] 17. /tmp/hlchtml/hlc-08-000146.debug.html - [0.0] 18. /tmp/hlchtml/hlc-08-000143.htm - [0.0] 19. /tmp/hlchtml/hlc-08-000020.debug.html - [-9223372036854775808.-922337203685477580] 20. /tmp/hlchtml/hlc-08-000048.debug.html - [-9223372036854775808.-922337203685477580] 21. /tmp/hlchtml/hlc-08-000149.htm - [-9223372036854775808.-922337203685477580] 22. /tmp/hlchtml/hlc-08-000112.htm - [-9223372036854775808.-922337203685477580] 23. /tmp/hlchtml/hlc-08-000143.debug.html - [-9223372036854775808.-922337203685477580] 24. /tmp/hlchtml/hlc-08-000119.debug.html - [-9223372036854775808.-922337203685477580] 25. /tmp/hlchtml/hlc-08-000136.debug.html - [-43116199.96836142] 26. /tmp/hlchtml/hlc-08-000027.debug.html - [0.0] 27. /tmp/hlchtml/hlc-08-000149.debug.html - [0.0] 28. /tmp/hlchtml/hlc-08-000049.debug.html - [0.0] 29. /tmp/hlchtml/hlc-08-000036.debug.html - [0.0] 30. /tmp/hlchtml/hlc-08-000112.debug.html - [0.0] 31. /tmp/hlchtml/hlc-08-000081.debug.html - [0.0] 32. /tmp/hlchtml/hlc-08-000047.debug.html - [-43116199.96836142] 33. /tmp/hlchtml/hlc-08-000015.debug.html - [-43116199.96836142] 34. /tmp/hlchtml/hlc-08-000029.debug.html - [-43116199.96836142] Search took: 1 ms. Screen dump took: 64 ms. _________________________________________________________________ Windows Live™: Life without walls. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009 |
|
From: Ariel <isa...@gm...> - 2009-01-30 21:13:54
|
Thanks for your answer. I am using the gcc version: 3.4.4 and Clucene version: clucene-core-0.9.21b, and the eclipse ganymedes. I have not idea why this is happening, I even configure Visualstudio to compile C/C++ with the intel compiler and it doesn't work neither. Could you help please ??? Is the clucene code only compatibility with the C/C++ compiler of microsoft ??? I hope you can help me. Regards Ariel On Fri, Jan 30, 2009 at 3:33 PM, Ben Van Klinken <bva...@gm...>wrote: > Hello. No idea sorry. I reguarly use clucene with gcc, so I don't think > it's clucene's fault. Which version are you using? > > Ben > > Verstuurd vanaf mijn iPhone > > Op 27 jan 2009 om 23:38 heeft Ariel <isa...@gm...> het volgende > geschreven:\ > > Hi every body: >> >> Could somebody tell me how can I use the Clucene library with Eclipse >> and cywin ??? >> >> I am working with Eclipse and cywin which C/C++ compiler is gcc, when >> I add Clucene as a project in VisualStudio the project doesn't throw >> errors but in Eclipse the gcc throws some errors in the include >> statements: >> >> [code] >> #include "CLucene.h" >> #include "CLucene/util/Reader.h" >> #include "CLucene/util/Misc.h" >> #include "CLucene/util/dirent.h" >> ... >> [/code] >> >> The gcc compiler says: can not find include file CLucene.h and the >> same for the others includes, then I check if the CLucene.h file >> exists in the right path and there is. >> >> Could you tell me why I am getting this error ??? >> >> Regards >> Ariel >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> Clucene-cvs mailing list >> Clu...@li... >> https://lists.sourceforge.net/lists/listinfo/clucene-cvs >> > |
|
From: Ariel <isa...@gm...> - 2009-01-27 22:43:52
|
Hi every body: Could somebody tell me how can I use the Clucene library with Eclipse and cywin ??? I am working with Eclipse and cywin which C/C++ compiler is gcc, when I add Clucene as a project in VisualStudio the project doesn't throw errors but in Eclipse the gcc throws some errors in the include statements: [code] #include "CLucene.h" #include "CLucene/util/Reader.h" #include "CLucene/util/Misc.h" #include "CLucene/util/dirent.h" ... [/code] The gcc compiler says: can not find include file CLucene.h and the same for the others includes, then I check if the CLucene.h file exists in the right path and there is. Could you tell me why I am getting this error ??? Regards Ariel |
|
From: <syn...@us...> - 2009-01-10 17:18:02
|
Revision: 2949
http://clucene.svn.sourceforge.net/clucene/?rev=2949&view=rev
Author: synhershko
Date: 2009-01-10 17:17:55 +0000 (Sat, 10 Jan 2009)
Log Message:
-----------
Fixes a heap corruption issue in NumberTools
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp
branches/lucene2_3_2/src/test/document/TestNumberTools.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp 2009-01-03 23:03:09 UTC (rev 2948)
+++ branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp 2009-01-10 17:17:55 UTC (rev 2949)
@@ -42,7 +42,7 @@
for ( int32_t i=1;i<STR_SIZE-len;i++ )
buf[i] = (int)'0';
- buf[STR_SIZE+1] = 0;
+ buf[STR_SIZE] = 0;
return buf;
}
Modified: branches/lucene2_3_2/src/test/document/TestNumberTools.cpp
===================================================================
--- branches/lucene2_3_2/src/test/document/TestNumberTools.cpp 2009-01-03 23:03:09 UTC (rev 2948)
+++ branches/lucene2_3_2/src/test/document/TestNumberTools.cpp 2009-01-10 17:17:55 UTC (rev 2949)
@@ -31,8 +31,8 @@
CuAssertTrue(tc, i == i2);
CuAssertTrue(tc, j == j2);
- //_CLDELETE_ARRAY(a);
- //_CLDELETE_ARRAY(b);
+ _CLDELETE_CARRAY(a);
+ _CLDELETE_CARRAY(b);
}
void testNearZero(CuTest *tc) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <syn...@us...> - 2009-01-03 23:03:21
|
Revision: 2948
http://clucene.svn.sourceforge.net/clucene/?rev=2948&view=rev
Author: synhershko
Date: 2009-01-03 23:03:09 +0000 (Sat, 03 Jan 2009)
Log Message:
-----------
Introducing NumberTools
Tweaked StringBuffer a bit
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/debug/error.h
branches/lucene2_3_2/src/core/CLucene.h
branches/lucene2_3_2/src/core/CMakeLists.txt
branches/lucene2_3_2/src/shared/CLucene/_SharedHeader.h
branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.cpp
branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.h
branches/lucene2_3_2/src/test/CMakeLists.txt
branches/lucene2_3_2/src/test/CuTest.cpp
branches/lucene2_3_2/src/test/test.h
branches/lucene2_3_2/src/test/tests.cpp
Added Paths:
-----------
branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp
branches/lucene2_3_2/src/core/CLucene/document/NumberTools.h
branches/lucene2_3_2/src/test/document/TestNumberTools.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/debug/error.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/debug/error.h 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/core/CLucene/debug/error.h 2009-01-03 23:03:09 UTC (rev 2948)
@@ -25,6 +25,7 @@
#define CL_ERR_UnknownOperator 14
#define CL_ERR_ConcurrentModification 15
#define CL_ERR_CorruptIndex 16
+#define CL_ERR_NumberFormat 17
Added: branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp (rev 0)
+++ branches/lucene2_3_2/src/core/CLucene/document/NumberTools.cpp 2009-01-03 23:03:09 UTC (rev 2948)
@@ -0,0 +1,81 @@
+/*------------------------------------------------------------------------------
+* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
+*
+* Distributable under the terms of either the Apache License (Version 2.0) or
+* the GNU Lesser General Public License, as specified in the COPYING file.
+------------------------------------------------------------------------------*/
+#include "CLucene/_ApiHeader.h"
+
+// Defining function macros missing in specific enviroments
+#ifndef _ttoi
+ #define _ttoi(x) (int)_tcstoi64(x,NULL,10)
+#endif
+
+#include "NumberTools.h"
+#include "CLucene/util/Misc.h"
+#include "CLucene/util/StringBuffer.h"
+
+CL_NS_DEF(document)
+
+const TCHAR* NumberTools::MIN_STRING_VALUE = NEGATIVE_PREFIX _T("0000000000000");
+const TCHAR* NumberTools::MAX_STRING_VALUE = POSITIVE_PREFIX _T("1y2p0ij32e8e7");
+
+TCHAR* NumberTools::longToString(int64_t l)
+{
+ if (l == LUCENE_INT64_MIN_SHOULDBE) {
+ // special case, because long is not symetric around zero
+ return stringDuplicate(MIN_STRING_VALUE);
+ }
+
+ TCHAR* buf = _CL_NEWARRAY(TCHAR, STR_SIZE + 1);
+ if (l < 0) {
+ buf[0] = NEGATIVE_PREFIX[0];
+ l = LUCENE_INT64_MAX_SHOULDBE + l + 1;
+ } else {
+ buf[0] = POSITIVE_PREFIX[0];
+ }
+
+ TCHAR tmp[STR_SIZE];
+ _i64tot(l, tmp, NUMBERTOOLS_RADIX);
+ size_t len = _tcslen(tmp);
+ _tcscpy(buf+(STR_SIZE-len),tmp);
+ for ( int32_t i=1;i<STR_SIZE-len;i++ )
+ buf[i] = (int)'0';
+
+ buf[STR_SIZE+1] = 0;
+
+ return buf;
+}
+
+int64_t NumberTools::stringToLong(TCHAR* str) {
+ if (str == NULL) {
+ _CLTHROWA(CL_ERR_NullPointer,"string cannot be null");
+ }
+ if (_tcslen(str) != STR_SIZE) {
+ _CLTHROWA(CL_ERR_NumberFormat,"string is the wrong size");
+ }
+
+ if (_tcscmp(str, MIN_STRING_VALUE) == 0) {
+ return LUCENE_INT64_MIN_SHOULDBE;
+ }
+
+ TCHAR prefix = str[0];
+
+ TCHAR* sentinel = NULL;
+ int64_t l = _tcstoi64(++str, &sentinel, NUMBERTOOLS_RADIX);
+
+ if (prefix == POSITIVE_PREFIX[0]) {
+ // nop
+ } else if (prefix == NEGATIVE_PREFIX[0]) {
+ l = l - LUCENE_INT64_MAX_SHOULDBE - 1;
+ } else {
+ _CLTHROWA(CL_ERR_NumberFormat,"string does not begin with the correct prefix");
+ }
+
+ return l;
+}
+
+NumberTools::~NumberTools(){
+}
+
+CL_NS_END
Added: branches/lucene2_3_2/src/core/CLucene/document/NumberTools.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/document/NumberTools.h (rev 0)
+++ branches/lucene2_3_2/src/core/CLucene/document/NumberTools.h 2009-01-03 23:03:09 UTC (rev 2948)
@@ -0,0 +1,75 @@
+/*------------------------------------------------------------------------------
+* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
+*
+* Distributable under the terms of either the Apache License (Version 2.0) or
+* the GNU Lesser General Public License, as specified in the COPYING file.
+------------------------------------------------------------------------------*/
+#ifndef _lucene_document_NumberTools_
+#define _lucene_document_NumberTools_
+
+CL_NS_DEF(document)
+
+/**
+ * Provides support for converting longs to Strings, and back again. The strings
+ * are structured so that lexicographic sorting order is preserved.
+ *
+ * <p>
+ * That is, if l1 is less than l2 for any two longs l1 and l2, then
+ * NumberTools.longToString(l1) is lexicographically less than
+ * NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
+ *
+ * <p>
+ * This class handles <b>all</b> long values (unlike
+ * {@link org.apache.lucene.document.DateField}).
+ *
+ *
+ */
+class CLUCENE_EXPORT NumberTools :LUCENE_BASE {
+
+ #define NUMBERTOOLS_RADIX 36
+
+ #define NEGATIVE_PREFIX _T("-")
+ // NB: NEGATIVE_PREFIX must be < POSITIVE_PREFIX
+ #define POSITIVE_PREFIX _T("0")
+
+public:
+ //NB: this must be less than
+ /**
+ * Equivalent to longToString(Long.MIN_VALUE); STR_SIZE is depandant on the length of it
+ */
+ LUCENE_STATIC_CONSTANT(TCHAR*, MIN_STRING_VALUE);
+
+ /**
+ * Equivalent to longToString(Long.MAX_VALUE)
+ */
+ LUCENE_STATIC_CONSTANT(TCHAR*, MAX_STRING_VALUE);
+
+ /**
+ * The length of (all) strings returned by {@link #longToString}
+ */
+ LUCENE_STATIC_CONSTANT (int32_t, STR_SIZE = 14);
+
+ /**
+ * Converts a long to a String suitable for indexing.
+ *
+ * @memory Caller should free the returned buffer
+ */
+ static TCHAR* longToString(int64_t l);
+
+ /**
+ * Converts a String that was returned by {@link #longToString} back to a
+ * long.
+ *
+ * @throws IllegalArgumentException
+ * if the input is null
+ * @throws NumberFormatException
+ * if the input does not parse (it was not a String returned by
+ * longToString()).
+ */
+ static int64_t stringToLong(TCHAR* str);
+
+ ~NumberTools();
+
+};
+CL_NS_END
+#endif
Modified: branches/lucene2_3_2/src/core/CLucene.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene.h 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/core/CLucene.h 2009-01-03 23:03:09 UTC (rev 2948)
@@ -32,6 +32,7 @@
#include "CLucene/document/Field.h"
#include "CLucene/document/DateField.h"
#include "CLucene/document/DateTools.h"
+#include "CLucene/document/NumberTools.h"
#include "CLucene/store/Directory.h"
#include "CLucene/store/FSDirectory.h"
#include "CLucene/queryParser/QueryParser.h"
Modified: branches/lucene2_3_2/src/core/CMakeLists.txt
===================================================================
--- branches/lucene2_3_2/src/core/CMakeLists.txt 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/core/CMakeLists.txt 2009-01-03 23:03:09 UTC (rev 2948)
@@ -52,6 +52,7 @@
./CLucene/document/DateTools.cpp
./CLucene/document/Field.cpp
./CLucene/document/FieldSelector.cpp
+ ./CLucene/document/NumberTools.cpp
./CLucene/index/IndexFileNames.cpp
./CLucene/index/SegmentMergeInfo.cpp
./CLucene/index/SegmentInfos.cpp
Modified: branches/lucene2_3_2/src/shared/CLucene/_SharedHeader.h
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/_SharedHeader.h 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/shared/CLucene/_SharedHeader.h 2009-01-03 23:03:09 UTC (rev 2948)
@@ -12,6 +12,9 @@
#include "CLucene/_clucene-config.h"
#include "CLucene/SharedHeader.h"
+#define LUCENE_INT64_MAX_SHOULDBE _ILONGLONG(0x7FFFFFFFFFFFFFFF)
+#define LUCENE_INT64_MIN_SHOULDBE (-LUCENE_INT64_MAX_SHOULDBE - _ILONGLONG(1) )
+
//required globally (internally only)
#include <stdio.h>
#include <stdlib.h>
Modified: branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.cpp
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.cpp 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.cpp 2009-01-03 23:03:09 UTC (rev 2948)
@@ -30,7 +30,7 @@
bufferOwner = true;
}
- StringBuffer::StringBuffer(const size_t initSize){
+ StringBuffer::StringBuffer(const size_t initSize, const bool consumeBuffer){
//Func - Constructor. Allocates a buffer of length initSize + 1
//Pre - initSize > 0
//Post - A buffer has been allocated of length initSize + 1
@@ -40,7 +40,7 @@
len = 0;
//Allocate a buffer of length bufferLength
buffer = _CL_NEWARRAY(TCHAR,bufferLength);
- bufferOwner = true;
+ bufferOwner = !consumeBuffer;
}
StringBuffer::StringBuffer(const TCHAR* value){
@@ -138,15 +138,15 @@
len += appendedLength;
}
- void StringBuffer::appendInt(const size_t value) {
+ void StringBuffer::appendInt(const int64_t value, const int32_t _Radix) {
//Func - Appends an integer (after conversion to a character string)
//Pre - true
//Post - The converted integer value has been appended to the string in buffer
//instantiate a buffer of 30 charactes for the conversion of the integer
TCHAR buf[30];
- //Convert the integer value to a string buf using the radix 10 (duh)
- _i64tot(value, buf, 10);
+ //Convert the integer value to a string buf using _Radix
+ _i64tot(value, buf, _Radix);
//Have the converted integer now stored in buf appended to the string in buffer
append(buf);
}
Modified: branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.h
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.h 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/shared/CLucene/util/StringBuffer.h 2009-01-03 23:03:09 UTC (rev 2948)
@@ -13,7 +13,7 @@
///Constructor. Allocates a buffer with the default length.
StringBuffer();
///Constructor. Allocates a buffer of length initSize + 1
- StringBuffer(const size_t initSize);
+ StringBuffer(const size_t initSize, const bool consumeBuffer = true);
///Constructor. Creates an instance of Stringbuffer containing a copy of
///the string value
StringBuffer(const TCHAR* value);
@@ -31,8 +31,8 @@
void append(const TCHAR* value);
///Appends a copy of the string value
void append(const TCHAR* value, size_t appendedLength);
- ///Appends an integer (after conversion to a character string)
- void appendInt(const size_t value);
+ ///Appends an integer (after conversion to a character string) with a default radix of 10. Radixes lower than 10 not supported.
+ void appendInt(const int64_t value, const int32_t _Radix = 10);
///Appends a float_t (after conversion to a character string)
void appendFloat(const float_t value, const size_t digits);
///Puts a copy of the string value in front of the current string in the StringBuffer
Modified: branches/lucene2_3_2/src/test/CMakeLists.txt
===================================================================
--- branches/lucene2_3_2/src/test/CMakeLists.txt 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/test/CMakeLists.txt 2009-01-03 23:03:09 UTC (rev 2948)
@@ -27,6 +27,7 @@
./analysis/TestAnalyzers.cpp
./debug/TestError.cpp
./document/TestDocument.cpp
+./document/TestNumberTools.cpp
./store/TestStore.cpp
./search/TestDateFilter.cpp
./search/TestForDuplicates.cpp
Modified: branches/lucene2_3_2/src/test/CuTest.cpp
===================================================================
--- branches/lucene2_3_2/src/test/CuTest.cpp 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/test/CuTest.cpp 2009-01-03 23:03:09 UTC (rev 2948)
@@ -250,8 +250,10 @@
CuString* message;
if (_tcscmp(expected, actual) == 0) return;
message = CuStringNew();
- CuStringAppend(message, preMessage);
- CuStringAppend(message, _T(" : ") );
+ if (preMessage) {
+ CuStringAppend(message, preMessage);
+ CuStringAppend(message, _T(" : ") );
+ }
CuStringAppend(message, _T("expected\n---->\n"));
CuStringAppend(message, expected);
CuStringAppend(message, _T("\n<----\nbut saw\n---->\n"));
Added: branches/lucene2_3_2/src/test/document/TestNumberTools.cpp
===================================================================
--- branches/lucene2_3_2/src/test/document/TestNumberTools.cpp (rev 0)
+++ branches/lucene2_3_2/src/test/document/TestNumberTools.cpp 2009-01-03 23:03:09 UTC (rev 2948)
@@ -0,0 +1,76 @@
+/*------------------------------------------------------------------------------
+* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
+*
+* Distributable under the terms of either the Apache License (Version 2.0) or
+* the GNU Lesser General Public License, as specified in the COPYING file.
+------------------------------------------------------------------------------*/
+#include "test.h"
+
+ void subtestTwoLongs(CuTest *tc, int64_t i, int64_t j) {
+ // convert to strings
+ TCHAR* a = NumberTools::longToString(i);
+ TCHAR* b = NumberTools::longToString(j);
+
+ // are they the right length?
+ CuAssertTrue(tc, NumberTools::STR_SIZE == _tcslen(a));
+ CuAssertTrue(tc, NumberTools::STR_SIZE == _tcslen(b));
+
+ // are they the right order?
+ if (i < j) {
+ CuAssertTrue(tc, _tcscmp(a,b) < 0);
+ } else if (i > j) {
+ CuAssertTrue(tc, _tcscmp(a,b) > 0);
+ } else {
+ CuAssertTrue(tc, _tcscmp(a,b) == 0);
+ }
+
+ // can we convert them back to longs?
+ int64_t i2 = NumberTools::stringToLong(a);
+ int64_t j2 = NumberTools::stringToLong(b);
+
+ CuAssertTrue(tc, i == i2);
+ CuAssertTrue(tc, j == j2);
+
+ //_CLDELETE_ARRAY(a);
+ //_CLDELETE_ARRAY(b);
+ }
+
+ void testNearZero(CuTest *tc) {
+ for (int32_t i = -100; i <= 100; i++) {
+ for (int32_t j = -100; j <= 100; j++) {
+ subtestTwoLongs(tc, i, j);
+ }
+ }
+ }
+
+ void testMin(CuTest *tc) {
+ // make sure the constants convert to their equivelents
+ CuAssertTrue(tc, LUCENE_INT64_MIN_SHOULDBE == NumberTools::stringToLong(const_cast<TCHAR*>(NumberTools::MIN_STRING_VALUE)));
+ CuAssertStrEquals(tc, _T("Min value"), NumberTools::MIN_STRING_VALUE, NumberTools::longToString(LUCENE_INT64_MIN_SHOULDBE));
+
+ // test near MIN, too
+ for (int64_t l = LUCENE_INT64_MIN_SHOULDBE; l < LUCENE_INT64_MIN_SHOULDBE + 10000; l++) {
+ subtestTwoLongs(tc,l, l + 1);
+ }
+ }
+
+ void testMax(CuTest *tc) {
+ // make sure the constants convert to their equivelents
+ CuAssertTrue(tc, LUCENE_INT64_MAX_SHOULDBE == NumberTools::stringToLong(const_cast<TCHAR*>(NumberTools::MAX_STRING_VALUE)));
+ CuAssertStrEquals(tc, _T("Max value"), NumberTools::MAX_STRING_VALUE, NumberTools::longToString(LUCENE_INT64_MAX_SHOULDBE));
+
+ // test near MAX, too
+ for (int64_t l = LUCENE_INT64_MAX_SHOULDBE; l > LUCENE_INT64_MAX_SHOULDBE - 10000; l--) {
+ subtestTwoLongs(tc,l, l - 1);
+ }
+ }
+
+CuSuite *testNumberTools(void)
+{
+ CuSuite *suite = CuSuiteNew(_T("CLucene Number Tools Test"));
+
+ SUITE_ADD_TEST(suite, testNearZero);
+ SUITE_ADD_TEST(suite, testMin);
+ SUITE_ADD_TEST(suite, testMax);
+ return suite;
+}
Modified: branches/lucene2_3_2/src/test/test.h
===================================================================
--- branches/lucene2_3_2/src/test/test.h 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/test/test.h 2009-01-03 23:03:09 UTC (rev 2948)
@@ -19,6 +19,8 @@
#include "CLucene/index/TermVector.h"
#include "CLucene/queryParser/MultiFieldQueryParser.h"
+#define LUCENE_INT64_MAX_SHOULDBE _ILONGLONG(0x7FFFFFFFFFFFFFFF)
+#define LUCENE_INT64_MIN_SHOULDBE (-LUCENE_INT64_MAX_SHOULDBE - _ILONGLONG(1) )
CL_NS_USE(index)
CL_NS_USE(util)
@@ -51,6 +53,7 @@
CuSuite *testutf8(void);
CuSuite *testreuters(void);
CuSuite *testdocument(void);
+CuSuite *testNumberTools(void);
class English{
public:
Modified: branches/lucene2_3_2/src/test/tests.cpp
===================================================================
--- branches/lucene2_3_2/src/test/tests.cpp 2008-12-09 05:17:59 UTC (rev 2947)
+++ branches/lucene2_3_2/src/test/tests.cpp 2009-01-03 23:03:09 UTC (rev 2948)
@@ -8,6 +8,7 @@
unittest tests[] = {
{"document", testdocument},
+ {"numbertools", testNumberTools},
{"debug", testdebug},
{"analysis", testanalysis},
{"analyzers", testanalyzers},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-08 16:01:12
|
Revision: 2946
http://clucene.svn.sourceforge.net/clucene/?rev=2946&view=rev
Author: ustramooner
Date: 2008-12-08 16:01:09 +0000 (Mon, 08 Dec 2008)
Log Message:
-----------
we should distinguish contribs as a library and contribs as seperate applications
Added Paths:
-----------
branches/lucene2_3_2/src/contribs-lib/
Removed Paths:
-------------
branches/lucene2_3_2/src/contribs/
Property changes on: branches/lucene2_3_2/src/contribs-lib
___________________________________________________________________
Added: svn:mergeinfo
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-08 15:46:23
|
Revision: 2945
http://clucene.svn.sourceforge.net/clucene/?rev=2945&view=rev
Author: ustramooner
Date: 2008-12-08 15:46:20 +0000 (Mon, 08 Dec 2008)
Log Message:
-----------
hide warning
Modified Paths:
--------------
branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake
Modified: branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake 2008-12-07 22:29:45 UTC (rev 2944)
+++ branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake 2008-12-08 15:46:20 UTC (rev 2945)
@@ -90,7 +90,9 @@
* character functions.
* Tests may display unpredictable behaviour if this is not defined.
*/
-#cmakedefine LUCENE_USE_INTERNAL_CHAR_FUNCTIONS 1
+#ifndef LUCENE_USE_INTERNAL_CHAR_FUNCTIONS
+ #cmakedefine LUCENE_USE_INTERNAL_CHAR_FUNCTIONS 1
+#endif
/** fix ansi for loop scope */
#if @CMAKE_ANSI_FOR_SCOPE@==0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-07 22:29:49
|
Revision: 2944
http://clucene.svn.sourceforge.net/clucene/?rev=2944&view=rev
Author: ustramooner
Date: 2008-12-07 22:29:45 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
fix for various pedantic warnings
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp
branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp
branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp
branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp
branches/lucene2_3_2/src/test/debug/TestError.cpp
branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp
branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp
branches/lucene2_3_2/src/test/index/TestUtf8.cpp
branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp
branches/lucene2_3_2/src/test/search/TestSearch.cpp
branches/lucene2_3_2/src/test/search/TestTermVector.cpp
branches/lucene2_3_2/src/test/testall.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/core/CLucene/index/SegmentInfos.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -44,8 +44,8 @@
this->dir = _dir;
}
-SegmentInfo::SegmentInfo(const char* _name, const int32_t _docCount, CL_NS(store)::Directory* _dir,
- bool _isCompoundFile, bool _hasSingleNormFile,
+SegmentInfo::SegmentInfo(const char* _name, const int32_t _docCount, CL_NS(store)::Directory* _dir,
+ bool _isCompoundFile, bool _hasSingleNormFile,
int32_t _docStoreOffset, const char* _docStoreSegment, bool _docStoreIsCompoundFile)
:
docCount(_docCount),
@@ -940,7 +940,7 @@
// try it if so:
const char* prevSegmentFileName = IndexFileNames::fileNameFromGeneration( IndexFileNames::SEGMENTS, "", gen-1 );
- bool prevExists;
+ bool prevExists=false;
if (directory != NULL)
prevExists = directory->fileExists(prevSegmentFileName);
//todo: File implementation below
Modified: branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/core/CLucene/queryParser/MultiFieldQueryParser.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -37,7 +37,7 @@
int32_t i = 0;
while ( fields[i] != NULL ){
Query* q = QueryParser::parse(query, fields[i], analyzer);
- if (q && (q->getQueryName()!="BooleanQuery" || ((BooleanQuery*)q)->getClauseCount() > 0)) {
+ if (q && (q->getQueryName()!=BooleanQuery::getClassName() || ((BooleanQuery*)q)->getClauseCount() > 0)) {
//todo: Move to using BooleanClause::Occur
bQuery->add(q, true, false, false);
} else {
@@ -57,7 +57,7 @@
while ( fields[i] != NULL )
{
Query* q = QueryParser::parse(query, fields[i], analyzer);
- if (q && (q->getQueryName()!="BooleanQuery" || ((BooleanQuery*)q)->getClauseCount() > 0)) {
+ if (q && (q->getQueryName()!=BooleanQuery::getClassName() || ((BooleanQuery*)q)->getClauseCount() > 0)) {
uint8_t flag = flags[i];
switch (flag)
{
Modified: branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp
===================================================================
--- branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/CLMonolithic_Test.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -25,6 +25,7 @@
#include "debug/TestError.cpp"
#include "document/TestDocument.cpp"
#include "queryParser/TestQueryParser.cpp"
+#include "queryParser/TestMultiFieldQueryParser.cpp"
#include "search/TestSearch.cpp"
#include "search/TestSort.cpp"
#include "search/TestTermVector.cpp"
Modified: branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp
===================================================================
--- branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/analysis/TestAnalyzers.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -10,7 +10,6 @@
Reader* reader = _CLNEW StringReader(input);
TokenStream* ts = a->tokenStream(_T("dummy"), reader );
- int32_t i = 0;
const TCHAR* pos = output;
TCHAR buffer[80];
const TCHAR* last = output;
Modified: branches/lucene2_3_2/src/test/debug/TestError.cpp
===================================================================
--- branches/lucene2_3_2/src/test/debug/TestError.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/debug/TestError.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -13,7 +13,6 @@
const char* msg = "test";
CLuceneError err ( 0,msg,false );
CLuceneError err2 = err;
- CLuceneError* err3 = &err;
CuAssert ( tc,_T ( "Error did not copy properly" ),err.what() !=err2.what() );
CuAssert ( tc,_T ( "Error values did not correspond" ),strcmp ( err.what(),err2.what() ) ==0 );
Modified: branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/index/TestHighFreqTerms.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -32,7 +32,6 @@
};
void _TestHighFreqTerms(const char* index, size_t numTerms) {
- uint64_t start = Misc::currentTimeMillis();
IndexReader* reader = IndexReader::open(index);
Modified: branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/index/TestIndexWriter.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -33,7 +33,6 @@
//test the ram loading
RAMDirectory ram2(&ram);
IndexReader* reader2 = IndexReader::open(&ram2);
- SegmentReader* segreader = (SegmentReader*)reader2;
Term* term = _CLNEW Term(_T("field"),fld);
TermEnum* en = reader2->terms(term);
CLUCENE_ASSERT(en->next());
Modified: branches/lucene2_3_2/src/test/index/TestUtf8.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestUtf8.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/index/TestUtf8.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -46,7 +46,6 @@
void testUTF8(CuTest *tc) {
RAMDirectory ram;
- Directory* pram = &ram;
StandardAnalyzer a;
IndexWriter ndx(&ram,&a,true);
_Index(tc, &ndx,"arabic");
Modified: branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp
===================================================================
--- branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -6,7 +6,7 @@
------------------------------------------------------------------------------*/
#include "test.h"
-class QPTestFilter: public TokenFilter {
+class MQPTestFilter: public TokenFilter {
public:
bool inPhrase;
@@ -16,7 +16,7 @@
* Filter which discards the token 'stop' and which expands the
* token 'phrase' into 'phrase1 phrase2'
*/
- QPTestFilter(TokenStream* in):
+ MQPTestFilter(TokenStream* in):
TokenFilter(in,true),
inPhrase(false),
savedStart(0),
@@ -46,14 +46,14 @@
}
};
-class QPTestAnalyzer: public Analyzer {
+class MQPTestAnalyzer: public Analyzer {
public:
- QPTestAnalyzer() {
+ MQPTestAnalyzer() {
}
/** Filters LowerCaseTokenizer with StopFilter. */
TokenStream* tokenStream(const TCHAR* fieldName, Reader* reader) {
- return _CLNEW QPTestFilter(_CLNEW LowerCaseTokenizer(reader));
+ return _CLNEW MQPTestFilter(_CLNEW LowerCaseTokenizer(reader));
}
};
@@ -74,7 +74,7 @@
void assertStopQueryEquals(CuTest *tc, const TCHAR* qtxt, const TCHAR* expectedRes) {
const TCHAR* fields[] = {_T("b"), _T("t"), NULL };
//Occur occur[] = {Occur.SHOULD, Occur.SHOULD};
- QPTestAnalyzer *a = _CLNEW QPTestAnalyzer();
+ MQPTestAnalyzer *a = _CLNEW MQPTestAnalyzer();
MultiFieldQueryParser mfqp(fields, a);
Query *q = mfqp.parse(qtxt);
Modified: branches/lucene2_3_2/src/test/search/TestSearch.cpp
===================================================================
--- branches/lucene2_3_2/src/test/search/TestSearch.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/search/TestSearch.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -351,9 +351,9 @@
Term* t = _CLNEW Term(_T("contents"), _T("a"));
query.add(_CLNEW TermQuery(t),true,false, false);
_CLDECDELETE(t);
- Hits* hits = searcher.search(&query);
- for ( int32_t x=0;x<hits->length();x++ ){
- Document& doc = hits->doc(x);
+ Hits* hits = searcher.search(&query);
+ for ( int32_t x=0;x<hits->length();x++ ){
+ hits->doc(x);
}
_CLDELETE(hits);
searcher.close();
Modified: branches/lucene2_3_2/src/test/search/TestTermVector.cpp
===================================================================
--- branches/lucene2_3_2/src/test/search/TestTermVector.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/search/TestTermVector.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -21,10 +21,10 @@
for (int32_t i = 0; i < hits->length(); i++)
{
- ObjectArray<TermFreqVector*> vector;
- CLUCENE_ASSERT(tv_searcher->getReader()->getTermFreqVectors(hits->id(i), (Array<TermFreqVector*>&)vector));
- CLUCENE_ASSERT(vector.length== 1);
- vector.deleteValues();
+ ObjectArray<TermFreqVector*> vector;
+ CLUCENE_ASSERT(tv_searcher->getReader()->getTermFreqVectors(hits->id(i), *(Array<TermFreqVector*>*)(&vector)));
+ CLUCENE_ASSERT(vector.length== 1);
+ vector.deleteValues();
}
_CLDELETE(hits);
@@ -172,6 +172,7 @@
float_t tf = sim->tf(freq);
float_t idf = sim->idf(term, &knownSearcher);
//float_t qNorm = sim.queryNorm()
+ idf += tf; //remove warning
int termsCount=0;
const TCHAR** terms = vector->getTerms();
@@ -181,6 +182,8 @@
//This is fine since we don't have stop words
float_t lNorm = sim->lengthNorm(_T("field"), termsCount);
+ lNorm ++;//remove warning
+
//float_t coord = sim.coord()
//System.out.println("TF: " + tf + " IDF: " + idf + " LenNorm: " + lNorm);
const TCHAR** vTerms = vector->getTerms();
@@ -212,6 +215,7 @@
//doc 3 should be the first hit b/c it is the shortest match
CLUCENE_ASSERT(hits->length() == 3);
float_t score = hits->score(0);
+ score++;
CLUCENE_ASSERT(2==hits->id(0) );
CLUCENE_ASSERT(3==hits->id(1) );
Modified: branches/lucene2_3_2/src/test/testall.cpp
===================================================================
--- branches/lucene2_3_2/src/test/testall.cpp 2008-12-07 20:13:07 UTC (rev 2943)
+++ branches/lucene2_3_2/src/test/testall.cpp 2008-12-07 22:29:45 UTC (rev 2944)
@@ -40,7 +40,7 @@
#endif
#endif
int ret_result = 0;
- int i;
+ int i=0;
int exclude = 0;
int list_provided = 0;
CuSuiteList *alltests = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-07 20:13:10
|
Revision: 2943
http://clucene.svn.sourceforge.net/clucene/?rev=2943&view=rev
Author: ustramooner
Date: 2008-12-07 20:13:07 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
fix various strict compiler warnings. some are actually really bad bugs!
IndexSearcher::getClassName was flawed
various comparisons were done with = instead of equality
more to come on this, this is just the beginning.
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp
branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp
branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp
branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp
branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h
branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp
branches/lucene2_3_2/src/core/CLucene/search/Searchable.h
branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h
branches/lucene2_3_2/src/core/CLucene/store/_Lock.h
branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h
branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake
Modified: branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/CLMonolithic.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -103,7 +103,6 @@
#include "CLucene/util/BitSet.cpp"
#include "CLucene/util/Equators.cpp"
#include "CLucene/util/FastCharStream.cpp"
-#include "CLucene/util/fileinputstream.cpp"
#include "CLucene/util/MD5Digester.cpp"
#include "CLucene/util/Reader.cpp"
#include "CLucene/util/StringIntern.cpp"
Modified: branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/index/FieldsReader.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -202,27 +202,26 @@
//TODO: Find an alternative approach here if this list continues to grow beyond the
//list of 5 or 6 currently here. See Lucene 762 for discussion
- if (acceptField = FieldSelector::LOAD) {
+ if (acceptField == FieldSelector::LOAD) {
addField(doc, fi, binary, compressed, tokenize);
}
- else if (acceptField = FieldSelector::LOAD_FOR_MERGE) {
+ else if (acceptField == FieldSelector::LOAD_FOR_MERGE) {
addFieldForMerge(doc, fi, binary, compressed, tokenize);
}
- else if (acceptField = FieldSelector::LOAD_AND_BREAK){
+ else if (acceptField == FieldSelector::LOAD_AND_BREAK){
addField(doc, fi, binary, compressed, tokenize);
break;//Get out of this loop
}
- else if (acceptField = FieldSelector::LAZY_LOAD) {
+ else if (acceptField == FieldSelector::LAZY_LOAD) {
addFieldLazy(doc, fi, binary, compressed, tokenize);
}
- else if (acceptField = FieldSelector::SIZE){
+ else if (acceptField == FieldSelector::SIZE){
skipField(binary, compressed, addFieldSize(doc, fi, binary, compressed));
}
- else if (acceptField = FieldSelector::SIZE_AND_BREAK){
+ else if (acceptField == FieldSelector::SIZE_AND_BREAK){
addFieldSize(doc, fi, binary, compressed);
break;
- }
- else {
+ }else {
skipField(binary, compressed);
}
@@ -440,8 +439,8 @@
int32_t FieldsReader::addFieldSize(CL_NS(document)::Document& doc, const FieldInfo* fi, const bool binary, const bool compressed) {
const int32_t size = fieldsStream->readVInt();
- const int32_t bytesize = binary || compressed ? size : 2*size;
/*
+ const int32_t bytesize = binary || compressed ? size : 2*size;
uint8_t* sizebytes = _CL_NEWARRAY(uint8_t, 4);
sizebytes[0] = (byte) (bytesize>>>24);
sizebytes[1] = (byte) (bytesize>>>16);
Modified: branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/Hits.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -75,7 +75,7 @@
// count # deletions, return -1 if unknown.
int32_t Hits::countDeletions(CL_NS(search)::Searcher* s) {
int32_t cnt = -1;
- if ( s->getClassName() == _T("IndexSearcher") ) {
+ if ( s->getObjectName() == IndexSearcher::getClassName() ) {
cnt = s->maxDoc() - static_cast<IndexSearcher*>(s)->getReader()->numDocs();
}
return cnt;
Modified: branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -367,8 +367,11 @@
return reader;
}
- const TCHAR* IndexSearcher::getClassName(){
- return _T("IndexSearcher");
+ const char* IndexSearcher::getClassName(){
+ return "IndexSearcher";
}
+ const char* IndexSearcher::getObjectName(){
+ return IndexSearcher::getClassName();
+ }
CL_NS_END
Modified: branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/IndexSearcher.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -36,16 +36,16 @@
bool readerOwner;
public:
- /** Creates a searcher searching the index in the named directory.
- * @throws CorruptIndexException if the index is corrupt
- * @throws IOException if there is a low-level IO error
+ /** Creates a searcher searching the index in the named directory.
+ * @throws CorruptIndexException if the index is corrupt
+ * @throws IOException if there is a low-level IO error
*/
IndexSearcher(const char* path);
- /** Creates a searcher searching the index in the provided directory.
- * @throws CorruptIndexException if the index is corrupt
- * @throws IOException if there is a low-level IO error
- */
+ /** Creates a searcher searching the index in the provided directory.
+ * @throws CorruptIndexException if the index is corrupt
+ * @throws IOException if there is a low-level IO error
+ */
IndexSearcher(CL_NS(store)::Directory* directory);
/** Creates a searcher searching the provided index. */
@@ -53,11 +53,11 @@
~IndexSearcher();
- /**
- * Note that the underlying IndexReader is not closed, if
- * IndexSearcher was constructed with IndexSearcher(IndexReader r).
- * If the IndexReader was supplied implicitly by specifying a directory, then
- * the IndexReader gets closed.
+ /**
+ * Note that the underlying IndexReader is not closed, if
+ * IndexSearcher was constructed with IndexSearcher(IndexReader r).
+ * If the IndexReader was supplied implicitly by specifying a directory, then
+ * the IndexReader gets closed.
*/
void close();
@@ -79,7 +79,8 @@
Query* rewrite(Query* original);
void explain(Query* query, int32_t doc, Explanation* ret);
- virtual const TCHAR* getClassName();
+ virtual const char* getObjectName();
+ static const char* getClassName();
};
CL_NS_END
#endif
Modified: branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/SearchHeader.cpp 2008-12-07 20:13:07 UTC (rev 2943)
@@ -184,11 +184,15 @@
return this->similarity;
}
-const TCHAR* Searcher::getClassName(){
- return _T("Searcher");
+const char* Searcher::getClassName(){
+ return "Searcher";
}
+const char* Searcher::getObjectName(){
+ return Searcher::getClassName();
+}
+
Weight::~Weight(){
}
Modified: branches/lucene2_3_2/src/core/CLucene/search/Searchable.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/Searchable.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/search/Searchable.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -172,7 +172,8 @@
*/
Similarity* getSimilarity();
- virtual const TCHAR* getClassName();
+ virtual const char* getObjectName();
+ static const char* getClassName();
virtual void _search(Query* query, Filter* filter, HitCollector* results) = 0;
};
Modified: branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/store/LockFactory.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -37,7 +37,7 @@
class CLUCENE_EXPORT SingleInstanceLockFactory: public LockFactory {
private:
LocksType* locks;
- DEFINE_MUTEX(locks_LOCK);
+ DEFINE_MUTEX(locks_LOCK)
public:
SingleInstanceLockFactory();
Modified: branches/lucene2_3_2/src/core/CLucene/store/_Lock.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/store/_Lock.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/store/_Lock.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -28,7 +28,7 @@
private:
const char* lockName;
LocksType* locks;
- DEFINE_MUTEX(*locks_LOCK);
+ DEFINE_MUTEX(*locks_LOCK)
public:
SingleInstanceLock( LocksType* locks, _LUCENE_THREADMUTEX* locks_LOCK, const char* lockName );
Modified: branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/core/CLucene/util/CLStreams.h 2008-12-07 20:13:07 UTC (rev 2943)
@@ -160,7 +160,7 @@
};
-class FilteredBufferedReader: public BufferedReader{
+class CLUCENE_EXPORT FilteredBufferedReader: public BufferedReader{
class Internal;
Internal* internal;
public:
Modified: branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake 2008-12-07 14:59:15 UTC (rev 2942)
+++ branches/lucene2_3_2/src/shared/CLucene/_clucene-config.h.cmake 2008-12-07 20:13:07 UTC (rev 2943)
@@ -92,7 +92,7 @@
*/
#cmakedefine LUCENE_USE_INTERNAL_CHAR_FUNCTIONS 1
-/** fix ansi for loop scope
+/** fix ansi for loop scope */
#if @CMAKE_ANSI_FOR_SCOPE@==0
#define for if (0); else for
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-07 14:59:21
|
Revision: 2942
http://clucene.svn.sourceforge.net/clucene/?rev=2942&view=rev
Author: ustramooner
Date: 2008-12-07 14:59:15 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
more c++ deprecated fixes
Modified Paths:
--------------
branches/lucene2_3_2/src/test/search/TestQueries.cpp
Modified: branches/lucene2_3_2/src/test/search/TestQueries.cpp
===================================================================
--- branches/lucene2_3_2/src/test/search/TestQueries.cpp 2008-12-07 14:58:00 UTC (rev 2941)
+++ branches/lucene2_3_2/src/test/search/TestQueries.cpp 2008-12-07 14:59:15 UTC (rev 2942)
@@ -10,7 +10,7 @@
void testPrefixQuery(CuTest *tc){
WhitespaceAnalyzer analyzer;
RAMDirectory directory;
- TCHAR* categories[] = {_T("/Computers"), _T("/Computers/Mac"), _T("/Computers/Windows")};
+ const TCHAR* categories[] = {_T("/Computers"), _T("/Computers/Mac"), _T("/Computers/Windows")};
IndexWriter writer( &directory, &analyzer, true);
for (int i = 0; i < 3; i++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-07 14:58:12
|
Revision: 2941
http://clucene.svn.sourceforge.net/clucene/?rev=2941&view=rev
Author: ustramooner
Date: 2008-12-07 14:58:00 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
gcc 4.3 deprecated features fix: use tr1 for hash_map, const TCHAR* must be used for strings.
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/store/FSDirectory.cpp
branches/lucene2_3_2/src/core/CLucene/util/VoidList.h
branches/lucene2_3_2/src/core/CLucene/util/VoidMap.h
branches/lucene2_3_2/src/shared/CLucene/clucene-config.h.cmake
branches/lucene2_3_2/src/shared/CMakeLists.txt
branches/lucene2_3_2/src/shared/cmake/CheckHashmaps.cmake
branches/lucene2_3_2/src/test/CuTest.cpp
branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp
branches/lucene2_3_2/src/test/store/TestStore.cpp
branches/lucene2_3_2/src/test/testall.cpp
branches/lucene2_3_2/src/test/util/TestPriorityQueue.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/store/FSDirectory.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/store/FSDirectory.cpp 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/core/CLucene/store/FSDirectory.cpp 2008-12-07 14:58:00 UTC (rev 2941)
@@ -353,7 +353,7 @@
refCount(0),
useMMap(LUCENE_USE_MMAP)
{
- _realpath(path,directory);//set a realpath so that if we change directory, we can still function
+ directory = _realpath(path,directory);//set a realpath so that if we change directory, we can still function
if ( !directory || !*directory ){
strcpy(directory,path);
}
Modified: branches/lucene2_3_2/src/core/CLucene/util/VoidList.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/util/VoidList.h 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/core/CLucene/util/VoidList.h 2008-12-07 14:58:00 UTC (rev 2941)
@@ -135,11 +135,11 @@
template<typename _kt,
typename _Comparator=CL_NS(util)::Compare::TChar,
typename _valueDeletor=CL_NS(util)::Deletor::Dummy>
-class CLUCENE_INLINE_EXPORT CLHashList:public __CLList<_kt, CL_NS_HASHING(hash_set)<_kt,_Comparator> , _valueDeletor>
+class CLUCENE_INLINE_EXPORT CLHashList:public __CLList<_kt, CL_NS_HASHING(_CL_HASH_SET)<_kt,_Comparator> , _valueDeletor>
{
public:
CLHashList ( const bool deleteValue=true ):
- __CLList<_kt, CL_NS_HASHING(hash_set)<_kt,_Comparator> , _valueDeletor>(deleteValue)
+ __CLList<_kt, CL_NS_HASHING(_CL_HASH_SET)<_kt,_Comparator> , _valueDeletor>(deleteValue)
{
}
};
Modified: branches/lucene2_3_2/src/core/CLucene/util/VoidMap.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/util/VoidMap.h 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/core/CLucene/util/VoidMap.h 2008-12-07 14:58:00 UTC (rev 2941)
@@ -10,7 +10,10 @@
#include "Equators.h"
#include "CLucene/LuceneThreads.h"
-#if defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
+#if defined(_CL_HAVE_TR1_UNORDERED_MAP) && defined(_CL_HAVE_TR1_UNORDERED_SET)
+ #include <tr1/unordered_map>
+ #include <tr1/unordered_set>
+#elif defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
//hashing is all or nothing!
#include <hash_map>
#include <hash_set>
@@ -186,10 +189,10 @@
typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
class CLUCENE_INLINE_EXPORT CLHashMap:public __CLMap<_kt,_vt,
- CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher,_Equals>,
+ CL_NS_HASHING(_CL_HASH_MAP)<_kt,_vt, _Hasher,_Equals>,
_KeyDeletor,_ValueDeletor>
{
- typedef __CLMap<_kt,_vt, CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher,_Equals>,
+ typedef __CLMap<_kt,_vt, CL_NS_HASHING(_CL_HASH_MAP)<_kt,_vt, _Hasher,_Equals>,
_KeyDeletor,_ValueDeletor> _this;
public:
CLHashMap ( const bool deleteKey=false, const bool deleteValue=false )
@@ -208,10 +211,10 @@
typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
class CLUCENE_INLINE_EXPORT CLHashMap:public __CLMap<_kt,_vt,
- CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher>,
+ CL_NS_HASHING(_CL_HASH_MAP)<_kt,_vt, _Hasher>,
_KeyDeletor,_ValueDeletor>
{
- typedef __CLMap<_kt,_vt, CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher>,
+ typedef __CLMap<_kt,_vt, CL_NS_HASHING(_CL_HASH_MAP)<_kt,_vt, _Hasher>,
_KeyDeletor,_ValueDeletor> _this;
public:
CLHashMap ( const bool deleteKey=false, const bool deleteValue=false )
Modified: branches/lucene2_3_2/src/shared/CLucene/clucene-config.h.cmake
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/clucene-config.h.cmake 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/shared/CLucene/clucene-config.h.cmake 2008-12-07 14:58:00 UTC (rev 2941)
@@ -24,6 +24,8 @@
#cmakedefine _CL_HAVE_DLFCN_H 1
#cmakedefine _CL_HAVE_EXT_HASH_MAP 1
#cmakedefine _CL_HAVE_EXT_HASH_SET 1
+#cmakedefine _CL_HAVE_TR1_UNORDERED_MAP 1
+#cmakedefine _CL_HAVE_TR1_UNORDERED_SET 1
#cmakedefine _CL_HAVE_HASH_MAP
#cmakedefine _CL_HAVE_HASH_SET
#cmakedefine _CL_HAVE_NDIR_H
@@ -69,6 +71,9 @@
/* If we use hashmaps, which namespace do we use: */
#define CL_NS_HASHING(func) ${CL_NS_HASHING_VALUE}
+/* If we use hashmaps, which classes do we use: */
+#define _CL_HASH_MAP ${_CL_HASH_MAP}
+#define _CL_HASH_SET ${_CL_HASH_SET}
/* define if the compiler implements namespaces */
#cmakedefine _CL_HAVE_NAMESPACES
Modified: branches/lucene2_3_2/src/shared/CMakeLists.txt
===================================================================
--- branches/lucene2_3_2/src/shared/CMakeLists.txt 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/shared/CMakeLists.txt 2008-12-07 14:58:00 UTC (rev 2941)
@@ -47,9 +47,9 @@
functional map vector list set math.h fcntl.h limits.h)
CHECK_OPTIONAL_HEADERS ( string.h sys/time.h memory.h sys/types.h
- stdint.h unistd.h io.h direct.h sys/dir.h sys/ndir.h dirent.h
+ stdint.h unistd.h io.h direct.h sys/dir.h sys/ndir.h dirent.h wctype.h fcntl.h
stat.h sys/stat.h stdexcept errno.h fcntl.h windef.h windows.h wchar.h
- wctype.h fcntl.h hash_map hash_set ext/hash_map ext/hash_set
+ hash_map hash_set ext/hash_map ext/hash_map tr1/unordered_set tr1/unordered_map
sys/timeb.h tchar.h strings.h stdexcept sys/mman.h winerror.h )
Modified: branches/lucene2_3_2/src/shared/cmake/CheckHashmaps.cmake
===================================================================
--- branches/lucene2_3_2/src/shared/cmake/CheckHashmaps.cmake 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/shared/cmake/CheckHashmaps.cmake 2008-12-07 14:58:00 UTC (rev 2941)
@@ -7,24 +7,38 @@
#find hashing namespace (internal, use CHECK_HASH_MAPS) ...
MACRO(HASHMAP_TEST HashingValue namespace)
IF ( NOT ${HashingValue} )
- IF ( _CL_HAVE_HASH_MAP )
- SET(CMAKE_REQUIRED_DEFINITIONS "-D_CL_HAVE_HASH_MAP=1")
- ENDIF ( _CL_HAVE_HASH_MAP )
- IF ( _CL_HAVE_EXT_HASH_MAP )
- SET(CMAKE_REQUIRED_DEFINITIONS "-D_CL_HAVE_EXT_HASH_MAP=1")
- ENDIF ( _CL_HAVE_EXT_HASH_MAP )
+ IF ( _CL_HAVE_TR1_UNORDERED_MAP )
+ SET(_CL_HASH_MAP unordered_map)
+ SET(_CL_HASH_SET unordered_set)
+ SET(CMAKE_REQUIRED_DEFINITIONS "-D_CL_HAVE_TR1_UNORDERED_MAP=1")
+ ELSE ( _CL_HAVE_TR1_UNORDERED_MAP )
+ IF ( _CL_HAVE_HASH_MAP )
+ SET(_CL_HASH_MAP hash_map)
+ SET(_CL_HASH_SET hash_set)
+ SET(CMAKE_REQUIRED_DEFINITIONS "-D_CL_HAVE_HASH_MAP=1")
+ ELSE ( _CL_HAVE_HASH_MAP )
+ IF ( _CL_HAVE_EXT_HASH_MAP )
+ SET(_CL_HASH_MAP hash_map)
+ SET(_CL_HASH_SET hash_set)
+ SET(CMAKE_REQUIRED_DEFINITIONS "-D_CL_HAVE_EXT_HASH_MAP=1")
+ ENDIF ( _CL_HAVE_EXT_HASH_MAP )
+ ENDIF ( _CL_HAVE_HASH_MAP )
+ ENDIF ( _CL_HAVE_TR1_UNORDERED_MAP )
STRING(TOUPPER ${namespace} NAMESPACE)
STRING(REPLACE / _ NAMESPACE ${NAMESPACE})
+ STRING(REPLACE : _ NAMESPACE ${NAMESPACE})
CHECK_CXX_SOURCE_COMPILES("
#if defined(_CL_HAVE_HASH_MAP)
#include <hash_map>
#elif defined(_CL_HAVE_EXT_HASH_MAP)
#include <ext/hash_map>
+#elif defined(_CL_HAVE_TR1_UNORDERED_MAP)
+ #include <tr1/unordered_map>
#endif
int main() {
- ${namespace}::hash_map<int,char> a;
+ ${namespace}::${_CL_HASH_MAP}<int,char> a;
return 0;
}
" _CL_HAVE_${NAMESPACE}_HASHMAP)
@@ -41,6 +55,7 @@
MACRO ( CHECK_HASH_MAPS HashingValue DisableHashing)
IF ( _CL_HAVE_EXT_HASH_MAP OR _CL_HAVE_HASH_MAP )
_CHOOSE_STATUS(PROGRESS "hashmaps" "namespace")
+ HASHMAP_TEST (${HashingValue} "std::tr1")
HASHMAP_TEST (${HashingValue} std)
HASHMAP_TEST (${HashingValue} stdext)
HASHMAP_TEST (${HashingValue} __gnu_cxx)
Modified: branches/lucene2_3_2/src/test/CuTest.cpp
===================================================================
--- branches/lucene2_3_2/src/test/CuTest.cpp 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/test/CuTest.cpp 2008-12-07 14:58:00 UTC (rev 2941)
@@ -6,6 +6,7 @@
------------------------------------------------------------------------------*/
#include "test.h"
#include "CuTest.h"
+#include <stdlib.h>
#include <assert.h>
static int verbose = 0;
Modified: branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp
===================================================================
--- branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/test/queryParser/TestMultiFieldQueryParser.cpp 2008-12-07 14:58:00 UTC (rev 2941)
@@ -71,7 +71,7 @@
}
// verify parsing of query using a stopping analyzer
-void assertStopQueryEquals(CuTest *tc, TCHAR* qtxt, TCHAR* expectedRes) {
+void assertStopQueryEquals(CuTest *tc, const TCHAR* qtxt, const TCHAR* expectedRes) {
const TCHAR* fields[] = {_T("b"), _T("t"), NULL };
//Occur occur[] = {Occur.SHOULD, Occur.SHOULD};
QPTestAnalyzer *a = _CLNEW QPTestAnalyzer();
Modified: branches/lucene2_3_2/src/test/store/TestStore.cpp
===================================================================
--- branches/lucene2_3_2/src/test/store/TestStore.cpp 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/test/store/TestStore.cpp 2008-12-07 14:58:00 UTC (rev 2941)
@@ -7,6 +7,7 @@
#include "test.h"
#include "CLucene/store/Directory.h"
#include "CLucene/store/IndexInput.h"
+#include <stdlib.h>
void hashTest(CuTest *tc){
//todo: this is testing internal stuff, turn it on again using a shared test..
Modified: branches/lucene2_3_2/src/test/testall.cpp
===================================================================
--- branches/lucene2_3_2/src/test/testall.cpp 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/test/testall.cpp 2008-12-07 14:58:00 UTC (rev 2941)
@@ -14,6 +14,7 @@
#endif
#include "test.h"
+#include <stdlib.h>
#include <fcntl.h>
#ifdef _CL_HAVE_DIRECT_H
@@ -193,7 +194,7 @@
_tprintf(_T("%s\n"), output->buffer);
if ( times )
- printf("Tests run in %dms\n\n",CL_NS(util)::Misc::currentTimeMillis()-startTime);
+ printf("Tests run in %dms\n\n", (int32_t)(CL_NS(util)::Misc::currentTimeMillis()-startTime));
exit_point:
if ( alltests != NULL )
Modified: branches/lucene2_3_2/src/test/util/TestPriorityQueue.cpp
===================================================================
--- branches/lucene2_3_2/src/test/util/TestPriorityQueue.cpp 2008-12-07 14:00:27 UTC (rev 2940)
+++ branches/lucene2_3_2/src/test/util/TestPriorityQueue.cpp 2008-12-07 14:58:00 UTC (rev 2941)
@@ -5,6 +5,7 @@
* the GNU Lesser General Public License, as specified in the COPYING file.
------------------------------------------------------------------------------*/
#include "test.h"
+#include <stdlib.h>
#include <time.h>
class integerQueue: public CL_NS(util)::PriorityQueue<int32_t,Deletor::DummyInt32 >{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-07 14:00:30
|
Revision: 2940
http://clucene.svn.sourceforge.net/clucene/?rev=2940&view=rev
Author: ustramooner
Date: 2008-12-07 14:00:27 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
gcc 4.3 compile fixes
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/search/PhrasePositions.cpp
branches/lucene2_3_2/src/shared/CLucene/config/repl_tprintf.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/search/PhrasePositions.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/PhrasePositions.cpp 2008-12-07 13:59:46 UTC (rev 2939)
+++ branches/lucene2_3_2/src/core/CLucene/search/PhrasePositions.cpp 2008-12-07 14:00:27 UTC (rev 2940)
@@ -60,7 +60,7 @@
//delete tp and reset tp to NULL
_CLVDELETE(tp); //todo: not a clucene object... should be
//Assign Doc sentinel value
- doc = INT_MAX;
+ doc = LUCENE_INT32_MAX_SHOULDBE;
return false;
}else{
doc = tp->doc();
Modified: branches/lucene2_3_2/src/shared/CLucene/config/repl_tprintf.cpp
===================================================================
--- branches/lucene2_3_2/src/shared/CLucene/config/repl_tprintf.cpp 2008-12-07 13:59:46 UTC (rev 2939)
+++ branches/lucene2_3_2/src/shared/CLucene/config/repl_tprintf.cpp 2008-12-07 14:00:27 UTC (rev 2940)
@@ -7,6 +7,8 @@
#include "CLucene/_SharedHeader.h"
#include "CLucene/util/StringBuffer.h"
+#include <limits.h> //MB_LEN_MAX
+
CL_NS_USE(util)
//print a variable argument to a stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-07 13:59:56
|
Revision: 2939
http://clucene.svn.sourceforge.net/clucene/?rev=2939&view=rev
Author: ustramooner
Date: 2008-12-07 13:59:46 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
removed old debugging fprintf's
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/util/ThreadLocal.cpp
branches/lucene2_3_2/src/test/index/TestReuters.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/util/ThreadLocal.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/util/ThreadLocal.cpp 2008-12-06 14:05:10 UTC (rev 2938)
+++ branches/lucene2_3_2/src/core/CLucene/util/ThreadLocal.cpp 2008-12-07 13:59:46 UTC (rev 2939)
@@ -59,8 +59,7 @@
//the key initialiser function
void pthread_threadlocal_make_key()
{
- printf("pthread_threadlocal_make_key\n");
- (void) pthread_key_create(&pthread_threadlocal_key, &pthread_threadlocal_destructor);
+ (void) pthread_key_create(&pthread_threadlocal_key, &pthread_threadlocal_destructor);
}
#endif
@@ -184,7 +183,6 @@
if ( threadLocals == NULL ){
threadLocals = _CLNEW ThreadLocals;
threadData->put(id,threadLocals);
- printf("starting thread %d\n",(int)id);
}
threadLocals->add(this);
}
@@ -235,7 +233,6 @@
{
_ThreadLocal* tl = this->back();
this->pop_back();
- printf ( "shutting down thread %d, object: %d, we have %d objects\n", ( int ) _LUCENE_CURRTHREADID, tl, this->size() );
tl->setNull();
}
Modified: branches/lucene2_3_2/src/test/index/TestReuters.cpp
===================================================================
--- branches/lucene2_3_2/src/test/index/TestReuters.cpp 2008-12-06 14:05:10 UTC (rev 2938)
+++ branches/lucene2_3_2/src/test/index/TestReuters.cpp 2008-12-07 13:59:46 UTC (rev 2939)
@@ -301,14 +301,12 @@
}
_LUCENE_THREAD_FUNC(threadedSearcherTest, arg){
IndexSearcher* searcher = (IndexSearcher*)arg;
- printf("thread started :-)...\n");
for ( int i=0;i<100;i++ ){
threadSearch(searcher, _T("test") );
threadSearch(searcher, _T("reuters") );
threadSearch(searcher, _T("data") );
}
- printf ("done...\n");
_LUCENE_THREAD_FUNC_RETURN(0);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ust...@us...> - 2008-12-06 14:05:15
|
Revision: 2938
http://clucene.svn.sourceforge.net/clucene/?rev=2938&view=rev
Author: ustramooner
Date: 2008-12-06 14:05:10 +0000 (Sat, 06 Dec 2008)
Log Message:
-----------
Mark Ashworth: fix for range query when not the whole range is given.
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParserBase.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParserBase.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParserBase.cpp 2008-10-23 18:15:36 UTC (rev 2937)
+++ branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParserBase.cpp 2008-12-06 14:05:10 UTC (rev 2938)
@@ -241,30 +241,33 @@
bool from=true;
while(tret)
{
- try{
- tret = source->next(&t);
- }catch (CLuceneError& err){
- if ( err.number() == CL_ERR_IO )
- tret=false;
- else
- throw err;
+ try{
+ tret = source->next(&t);
+ }catch (CLuceneError& err){
+ if ( err.number() == CL_ERR_IO )
+ tret=false;
+ else
+ throw err;
+ }
+ if (tret)
+ {
+ if ( !from && _tcscmp(t.termBuffer(),_T("TO"))==0 )
+ continue;
+
+
+ TCHAR* tmp = STRDUP_TtoT(t.termBuffer());
+ discardEscapeChar(tmp);
+ terms[from? 0 : 1] = tmp;
+
+ if (from)
+ from = false;
+ else
+ break;
+ }
+ }
+ if ((terms[0] == NULL) || (terms[1] == NULL)) {
+ _CLTHROWA(CL_ERR_Parse, "No range given.");
}
- if (tret)
- {
- if ( !from && _tcscmp(t.termBuffer(),_T("TO"))==0 )
- continue;
-
-
- TCHAR* tmp = STRDUP_TtoT(t.termBuffer());
- discardEscapeChar(tmp);
- terms[from? 0 : 1] = tmp;
-
- if (from)
- from = false;
- else
- break;
- }
- }
Query* ret = GetRangeQuery(field, terms[0], terms[1],inclusive);
_CLDELETE_CARRAY(terms[0]);
_CLDELETE_CARRAY(terms[1]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Hellen <he...@es...> - 2008-10-31 15:02:26
|
Hi,
I am C/C++ starter and what I need to do is creating an ATL COM object
implementing CLucenes sources to be used by another application based on
VB. For that, I have to create an interfaces methods for indexing files and
searching them by the documents id provided as a parameter... I am
studding this project about some months and Ive already spent a hard time
trying to understand and define the required classes for indexing files and
search them (I mean the classes functionality). After a large time, I think
I have made all customizations what I needed to the original demo project
and now I have the component object created and working... But I have some
points to review
One of these customizations is that when I do a search by the id document
provided I want to return the Hits containing the found documents as the
search results to the Hits object interface property. Another method will
read that Hits property already loaded and returns the documents stored
on it, providing the id as the interface return method.
The problem is that I have to instantiate each document from Hits on
SearchFiles before return it to the Hits object component property. Like
that its working properly but if Id do it when I try to get the documents
from the Hits property I have null documents
My question is: Why? This is
so abstract for me and does not make sense, because if I get the documents
in my SearchFiles those instances will exists only at SearchFiles
runtime
And I do not use those documents instances for nothing - I just
call them before return the Hits container. So, when GetFoundDocument
calls the documents into Hits object property, that should returns the
loaded documents from the Hits property without instance them before the
loading (Just From Hits to Hits must to get all Hits contents, right?!).
I am using Visual Studio 2008 with ATL Project type. Follow
LuceneComponent.cpp class which is the implementation of the methods to get
the general idea how the client will use the component
and the
LuceneFunctions.cpp class to get the Index and Search process.
Thanks a lot in advance!
-Components Interface Methods :: LuceneComponent.cpp-
#include "LuceneActiveX.h"
#include "LuceneComponent.h"
// External Functions (declarations)
void IndexFiles(char* path, char* id, char* target, const bool
clearIndex);
Hits* SearchFiles(const char* index, char* line);
BSTR SearchFiles(Hits* hit, long idoc);
BSTR SearchFiles(Hits* hHit, int iDoc);
long DeleteFiles(const char* dir);
int DeleteFile(const char* target, int iDoc);
int GetStats(const char* directory);
int GetiDoc(char* path, char* target);
// Internal Variables (Object Properties)
char lpIndex[_MAX_PATH]; //Stores the path of the Index.
int lcIniciado; //Stores the status of the inicialization
process.
Hits* hHit; //Stores the Search results.
//Methods
//StartupTest
STDMETHODIMP CLuceneComponent::TestaIniciar (BSTR* Status)
{
[...]
// Inicialization Test
}
//Startup
STDMETHODIMP CLuceneComponent::Iniciar(LPSTR Chave, LPSTR IndiceDir, LPSTR
*Config, long *Status)
{
[...]
// Successfully Startup will load the the path of the Index
(IndiceDir) into lpIndex and returns 1. The another parameters are to set
own component properties
}
//IndexFile
STDMETHODIMP CLuceneComponent::IndexarArquivo(LPSTR ArquivoDir, LPSTR DocId,
LPSTR Tipo, long* nDocs)
{
if(lcIniciado!=1) //Startup Test
{
return S_FALSE;
}else{
//IndexFiles is internal function
See LuceneFunctions.cpp
IndexFiles(ArquivoDir, DocId,lpIndex, false);
//Returns the number of stored documents in the Index.
IndexSearcher s(lpIndex);
*nDocs = s.maxDoc();
return S_OK;
}
}
//GetIndexSize
STDMETHODIMP CLuceneComponent::ObterTamanhoIndice(long* nDocs)
{
//Test if the Index directory has an Index segments
if(!IndexReader::indexExists(lpIndex)){
*nDocs = -1;
return S_OK;
}
//Returns the number of stored documents in the Index.
IndexSearcher s(lpIndex);
*nDocs = s.getReader()->numDocs();
return S_OK;
}
//SearchFiles
STDMETHODIMP CLuceneComponent::Pesquisar(LPSTR StringReferencia, long
*nArquivos)
{
//SearchFiles is an internal function and has 3 overloads!
//See LuceneFunctions.cpp
hHit = SearchFiles(lpIndex, StringReferencia);
//Returns the number of found documents
Note: Its obtained from the Hits
component property loaded by SearchFiles return!
*nArquivos = hHit->length();
return S_OK;
}
//GetFoundDocumentPath
STDMETHODIMP CLuceneComponent::ObterDocDir(long iDoc, BSTR *docDir)
{
CComBSTR bsCom;
//Test if the search has result.
if(hHit->length() != 0)
{
//SearchFiles is an internal function and has 3 overloads!
//See LuceneFunctions.cpp
bsCom.AppendBSTR(SearchFiles(hHit, iDoc));
*docDir = bsCom.Detach();
}else{
//Returns a message informing that there is no search result.
bsCom.Append("A pesquisa não retornou resultados!");
*docDir = bsCom.Detach();
}
return S_OK;
}
//GetFoundDocumentID
STDMETHODIMP CLuceneComponent::ObterDocID(long iDoc, BSTR *docID)
{
CComBSTR bsCom;
//Test if the search has result.
if(hHit->length() != 0)
{
//SearchFiles is an internal function and has 3 overloads!
//See LuceneFunctions.cpp
bsCom.AppendBSTR(SearchFiles(hHit, (int)iDoc));
*docID = bsCom.Detach();
}else{
//Returns a message informing that there is no search result.
bsCom.Append("A pesquisa não retornou resultados!");
*docID = bsCom.Detach();
}
return S_OK;
}
//GetFoundDocumentScore
STDMETHODIMP CLuceneComponent::ObterDocScore(long iDoc, float *docScore)
{
//Test if the search has result.
if(hHit->length() != 0)
{
//Returns the document score obtained by the Hits property.
//Note: Its obtained from the Hits component property
loaded by SearchFiles return!
*docScore = hHit->score((int)iDoc);
}else{
//Abort it
*docScore = 0;
}
return S_OK;
}
//ClearIndex (DeleteAllDocuments)
STDMETHODIMP CLuceneComponent::LimparIndice(long *nDocs)
{
//ClearIndex is an internal function
See LuceneFunctions.cpp
*nDocs = DeleteFiles(lpIndex);
return S_OK;
}
//GetIndexStatistics
STDMETHODIMP CLuceneComponent::ObterEstatisticas(long *Resultado)
{
//Return Index Statistics
[
]
}
//DeleteDocument
STDMETHODIMP CLuceneComponent::ExcluirDoc(LPSTR DocId, int *Status)
{
//DeleteFile is an internal function
See LuceneFunctions.cpp
*Status = DeleteFile(lpIndex, GetiDoc(DocId,lpIndex) );
return S_OK;
}
-Lucene Functions :: LuceneFunctions.cpp-
#include <iostream>
#include <fstream>
#include "stdafx.h"
#include "CLucene.h"
#include "CLucene/util/Reader.h"
#include "CLucene/util/Misc.h"
#include "CLucene/util/dirent.h"
#include "CLucene/index/Term.h"
#include "CLucene/index/SegmentTermEnum.h"
using namespace std;
using namespace lucene::index;
using namespace lucene::analysis;
using namespace lucene::util;
using namespace lucene::search;
using namespace lucene::store;
using namespace lucene::document;
using namespace lucene::queryParser;
//Creates a Document defining the fields and fill them with the file
information contents
Document* FileDocument(const char* f, const char* id){
Document* doc = _CLNEW Document();
TCHAR tbuf[CL_MAX_DIR];
STRCPY_AtoT(tbuf,f,CL_MAX_DIR);
doc->add( *_CLNEW Field(_T("path"), tbuf, true,true,false ) );
STRCPY_AtoT(tbuf,id,CL_MAX_DIR);
doc->add( *_CLNEW Field(_T("id"), tbuf, true,true,false ) );
FILE* fh = fopen(f,"r");
if ( fh != NULL ){
StringBuffer str;
int fn = fileno(fh);
struct stat filestat;
fstat(fn, &filestat);
str.reserve(filestat.st_size);
char abuf[1024];
TCHAR tbuf[1024];
size_t r;
do{
r = fread(abuf,1,1023,fh);
abuf[r]=0;
STRCPY_AtoT(tbuf,abuf,r);
tbuf[r]=0;
str.append(tbuf);
}while(r>0);
fclose(fh);
doc->add( *_CLNEW
Field(_T("contents"),str.getBuffer(),true,true,true));
}
return doc;
}
//Add to the Index the Document created by FileDocument
void IndexFiles(char* path, char* id, char* target, const bool clearIndex){
IndexWriter* writer = NULL;
lucene::analysis::standard::StandardAnalyzer an;
if ( !clearIndex && IndexReader::indexExists(target) ){
if ( IndexReader::isLocked(target) ){
IndexReader::unlock(target);
}
writer = _CLNEW IndexWriter( target, &an, false);
}else{
writer = _CLNEW IndexWriter( target ,&an, true);
}
writer->setMaxFieldLength(IndexWriter::DEFAULT_MAX_FIELD_LENGTH);
Document* doc = FileDocument(path,id);
writer->addDocument(doc);
writer->optimize();
writer->close();
_CLDELETE(writer);
}
int32_t GetStats(const char* directory)
{
[
]
}
//Search for files which have the provided term in the contents field
Hits* SearchFiles(const char* index, char* line)
{
TCHAR tline [256];
standard::StandardAnalyzer analyzer;
IndexSearcher s(index);
STRCPY_AtoT(tline, line, strlen(line));
tline[strlen(line)]=0;
Query* q = QueryParser::parse(tline,_T("contents"), &analyzer);
Hits* hit = s.search(q);
//Here_ I have to do it before returning Hits
int size = hit->length();
for(int i=0; i<size; i++)
{
Document *doc = &hit->doc(i);
CComBSTR bstr = doc->get(_T("path"));
}
//_CLDELETE(hit);
_CLDELETE(q);
s.close();
return hit;
}
//Returns the document path field value
//Note: I have to create this function here because if I call the document
by the component interface from Hits property that will be null
BSTR SearchFiles(Hits* hit, long idoc)
{
Document *doc = &hit->doc((int)idoc);
CComBSTR bstr = doc->get(_T("path"));
return bstr.Detach();
}
//Returns the id path field value
BSTR SearchFiles(Hits* hit, int idoc)
{
Document *doc = &hit->doc(idoc);
CComBSTR bstr = doc->get(_T("id"));
return bstr.Detach();
}
//Delete all files from the index
long DeleteFiles(const char *dir) {
IndexReader* reader = IndexReader::open(dir);
long count = 0;
for (int32_t i = 0; i < reader->maxDoc(); i++)
{
reader->deleteDocument (i);
count ++;
}
reader->close();
_CLDELETE(reader);
//OPTIMIZE
if ( IndexReader::indexExists(dir) )
{
lucene::analysis::SimpleAnalyzer an;
if ( IndexReader::isLocked(dir) )
{
IndexReader::unlock(dir);
}
IndexWriter* writer = _CLNEW IndexWriter( dir, &an,
false);
writer->optimize();
_CLDELETE(writer);
}
return count;
}
//Delete one file
int DeleteFile(const char *target, int iDoc)
{
IndexReader* reader = IndexReader::open(target);
CComBSTR path;
if (reader->numDocs() == 0)
return -1;
if ((iDoc < reader->numDocs()) && (iDoc > -1)){
reader->deleteDocument (iDoc);
reader->close();
_CLDELETE(reader);
//OPTIMIZE
if ( IndexReader::indexExists(target) ){
lucene::analysis::SimpleAnalyzer an;
if ( IndexReader::isLocked(target) )
{
IndexReader::unlock(target);
}
IndexWriter* writer = _CLNEW IndexWriter(
target, &an, false);
writer->optimize();
_CLDELETE(writer);
return iDoc;
}
reader->close();
_CLDELETE(reader);
return -1;
}
}
//Returns the document position from Hits by the document id
int32_t GetiDoc(char* id, char* target){
IndexReader* reader = IndexReader::open(target);
if (reader->numDocs() == 0)
return -1;
Document *doc;
long count = 0;
for (int32_t i = 0; i < reader->maxDoc(); i++)
{
doc = reader->document(i);
CComBSTR str = doc->get(_T("id"));
if(str == id){
Term term = Term(_T("id"),_T(id));
//I have created int getNumDocByTermDocs(Term*) method because I can not
found another way to get the document position to the Hits in this theatre!
This is another point to get help =)
int32_t docid =
reader->getNumDocByTermDocs(&term);
reader->close();
_CLDELETE(reader);
return docid;
}
count ++;
}
reader->close();
_CLDELETE(reader);
return -1;
}
|
|
From: <ust...@us...> - 2008-10-23 18:15:40
|
Revision: 2937
http://clucene.svn.sourceforge.net/clucene/?rev=2937&view=rev
Author: ustramooner
Date: 2008-10-23 18:15:36 +0000 (Thu, 23 Oct 2008)
Log Message:
-----------
fs directory patch. potential segfault with multithreaded use
Modified Paths:
--------------
trunk/src/CLucene/store/FSDirectory.cpp
trunk/src/CLucene/store/FSDirectory.h
Modified: trunk/src/CLucene/store/FSDirectory.cpp
===================================================================
--- trunk/src/CLucene/store/FSDirectory.cpp 2008-10-10 10:47:49 UTC (rev 2936)
+++ trunk/src/CLucene/store/FSDirectory.cpp 2008-10-23 18:15:36 UTC (rev 2937)
@@ -65,7 +65,7 @@
if ( other.handle == NULL )
_CLTHROWA(CL_ERR_NullPointer, "other handle is null");
- SCOPED_LOCK_MUTEX(other.handle->THIS_LOCK)
+ SCOPED_LOCK_MUTEX(*other.handle->THIS_LOCK)
handle = _CL_POINTER(other.handle);
_pos = other.handle->_fpos; //note where we are currently...
}
@@ -75,6 +75,10 @@
_length = 0;
_fpos = 0;
path[0]=0;
+
+#ifdef _LUCENE_THREADMUTEX
+ THIS_LOCK = new _LUCENE_THREADMUTEX;
+#endif
}
FSDirectory::FSIndexInput::SharedHandle::~SharedHandle() throw(CLuceneError&){
if ( fhandle >= 0 ){
@@ -99,8 +103,32 @@
return _CLNEW FSDirectory::FSIndexInput(*this);
}
void FSDirectory::FSIndexInput::close() {
- BufferedIndexInput::close();
- _CLDECDELETE(handle);
+ BufferedIndexInput::close();
+#ifdef _LUCENE_THREADMUTEX
+ if ( handle != NULL ){
+ //here we have a bit of a problem... we need to lock the handle to ensure that we can
+ //safely delete the handle... but if we delete the handle, then the scoped unlock,
+ //won't be able to unlock the mutex...
+
+ //take a reference of the lock object...
+ _LUCENE_THREADMUTEX* mutex = handle->THIS_LOCK;
+ //lock the mutex
+ mutex->lock();
+
+ //determine if we are about to delete the handle...
+ bool dounlock = ( handle->__cl_refcount > 1 );
+ //decdelete (deletes if refcount is down to 0
+ _CLDECDELETE(handle);
+
+ if ( dounlock ){
+ mutex->unlock();
+ }else{
+ delete mutex;
+ }
+ }
+#else
+ _CLDECDELETE(handle);
+#endif
}
void FSDirectory::FSIndexInput::seekInternal(const int64_t position) {
@@ -110,7 +138,7 @@
/** IndexInput methods */
void FSDirectory::FSIndexInput::readInternal(uint8_t* b, const int32_t len) {
- SCOPED_LOCK_MUTEX(handle->THIS_LOCK)
+ SCOPED_LOCK_MUTEX(*handle->THIS_LOCK)
CND_PRECONDITION(handle!=NULL,"shared file handle has closed");
CND_PRECONDITION(handle->fhandle>=0,"file is not open");
Modified: trunk/src/CLucene/store/FSDirectory.h
===================================================================
--- trunk/src/CLucene/store/FSDirectory.h 2008-10-10 10:47:49 UTC (rev 2936)
+++ trunk/src/CLucene/store/FSDirectory.h 2008-10-23 18:15:36 UTC (rev 2937)
@@ -84,9 +84,9 @@
class SharedHandle: LUCENE_REFBASE{
public:
int32_t fhandle;
- int64_t _length;
- int64_t _fpos;
- DEFINE_MUTEX(THIS_LOCK)
+ int64_t _length;
+ int64_t _fpos;
+ DEFINE_MUTEX(*THIS_LOCK)
char path[CL_MAX_DIR]; //todo: this is only used for cloning, better to get information from the fhandle
SharedHandle();
~SharedHandle() throw(CLuceneError&);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <syn...@us...> - 2008-10-10 11:32:19
|
Revision: 2936
http://clucene.svn.sourceforge.net/clucene/?rev=2936&view=rev
Author: synhershko
Date: 2008-10-10 10:47:49 +0000 (Fri, 10 Oct 2008)
Log Message:
-----------
Misc cleanups and some porting progress
Modified Paths:
--------------
branches/lucene2_3_2/src/core/CLucene/files_list.txt
branches/lucene2_3_2/src/core/CLucene/index/CompoundFile.cpp
branches/lucene2_3_2/src/core/CLucene/index/_CompoundFile.h
branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.cpp
branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.h
branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.cpp
branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.h
branches/lucene2_3_2/src/core/CLucene/search/Sort.h
branches/lucene2_3_2/src/core/CLucene/store/IndexInput.cpp
Modified: branches/lucene2_3_2/src/core/CLucene/index/CompoundFile.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/CompoundFile.cpp 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/index/CompoundFile.cpp 2008-10-10 10:47:49 UTC (rev 2936)
@@ -57,7 +57,7 @@
}
public:
- CSIndexInput(CL_NS(store)::IndexInput* base, const int64_t fileOffset, const int64_t length);
+ CSIndexInput(CL_NS(store)::IndexInput* base, const int64_t fileOffset, const int64_t length, const int32_t readBufferSize = CL_NS(store)::BufferedIndexInput::BUFFER_SIZE);
CSIndexInput(const CSIndexInput& clone);
~CSIndexInput();
@@ -83,7 +83,7 @@
};
-CSIndexInput::CSIndexInput(CL_NS(store)::IndexInput* base, const int64_t fileOffset, const int64_t length){
+CSIndexInput::CSIndexInput(CL_NS(store)::IndexInput* base, const int64_t fileOffset, const int64_t length, const int32_t _readBufferSize):BufferedIndexInput(_readBufferSize){
this->base = base;
this->fileOffset = fileOffset;
this->_length = length;
@@ -97,7 +97,7 @@
if(start + len > _length)
_CLTHROWA(CL_ERR_IO,"read past EOF");
base->seek(fileOffset + start);
- base->readBytes(b, len);
+ base->readBytes(b, len /*todo: , false*/);
}
CSIndexInput::~CSIndexInput(){
}
@@ -116,16 +116,17 @@
-CompoundFileReader::CompoundFileReader(Directory* dir, char* name):
+CompoundFileReader::CompoundFileReader(Directory* dir, char* name, int32_t _readBufferSize):
entries(_CLNEW EntriesType(true,true))
{
directory = dir;
fileName = STRDUP_AtoA(name);
+ readBufferSize = _readBufferSize;
bool success = false;
try {
- stream = dir->openInput(name);
+ stream = dir->openInput(name, readBufferSize);
// read the directory and init files
int32_t count = stream->readVInt();
@@ -192,24 +193,26 @@
}
bool CompoundFileReader::openInput(const char * id, CL_NS(store)::IndexInput *& ret, CLuceneError& error, int32_t bufferSize){
- SCOPED_LOCK_MUTEX(THIS_LOCK)
+ SCOPED_LOCK_MUTEX(THIS_LOCK);
if (stream == NULL){
- error.set(CL_ERR_IO,"Stream closed");
- return false;
+ error.set(CL_ERR_IO,"Stream closed");
+ return false;
}
-
- const ReaderFileEntry* entry = entries->get(id);
- if (entry == NULL){
- char buf[CL_MAX_PATH+30];
- strcpy(buf,"No sub-file with id ");
- strncat(buf,id,CL_MAX_PATH);
- strcat(buf," found");
- error.set(CL_ERR_IO,buf);
- return false;
- }
- ret = _CLNEW CSIndexInput(stream, entry->offset, entry->length);
- return true;
+
+ const ReaderFileEntry* entry = entries->get(id);
+ if (entry == NULL){
+ char buf[CL_MAX_PATH+26];
+ cl_sprintf(buf, CL_MAX_PATH+26, "No sub-file with id %s found", id);
+ error.set(CL_ERR_IO,buf);
+ return false;
+ }
+
+ if (bufferSize < 1)
+ bufferSize = readBufferSize;
+
+ ret = _CLNEW CSIndexInput(stream, entry->offset, entry->length, bufferSize);
+ return true;
}
void CompoundFileReader::list(vector<string>* names) const{
Modified: branches/lucene2_3_2/src/core/CLucene/index/_CompoundFile.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/index/_CompoundFile.h 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/index/_CompoundFile.h 2008-10-10 10:47:49 UTC (rev 2936)
@@ -11,6 +11,7 @@
CL_CLASS_DEF(store,Lock)
#include "CLucene/util/VoidMapSetDefinitions.h"
#include "CLucene/store/Directory.h"
+#include "CLucene/store/IndexInput.h"
CL_NS_DEF(index)
@@ -25,6 +26,8 @@
*/
class CompoundFileReader: public CL_NS(store)::Directory {
private:
+ int32_t readBufferSize;
+
// Base info
CL_NS(store)::Directory* directory;
char* fileName;
@@ -42,13 +45,13 @@
bool doDeleteFile(const char* name);
public:
- CompoundFileReader(CL_NS(store)::Directory* dir, char* name);
+ CompoundFileReader(CL_NS(store)::Directory* dir, char* name, int32_t _readBufferSize=CL_NS(store)::BufferedIndexInput::BUFFER_SIZE);
~CompoundFileReader();
CL_NS(store)::Directory* getDirectory();
const char* getName() const;
void close();
- bool openInput(const char * name, CL_NS(store)::IndexInput *& ret, CLuceneError& error, int32_t bufferSize=1);
+ bool openInput(const char * name, CL_NS(store)::IndexInput *& ret, CLuceneError& error, int32_t bufferSize=0);
/** Returns an array of strings, one for each file in the directory-> */
void list(std::vector<std::string>* names) const;
Modified: branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.cpp 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.cpp 2008-10-10 10:47:49 UTC (rev 2936)
@@ -362,4 +362,52 @@
return ret;
}
+ /*
+ Query* FuzzyQuery::rewrite(IndexReader* reader) {
+ FilteredTermEnum* enumerator = getEnum(reader);
+ int32_t maxClauseCount = BooleanQuery::getMaxClauseCount();
+ ScoreTermQueue* stQueue = _CLNEW ScoreTermQueue(maxClauseCount);
+ ScoreTerm* reusableST = NULL;
+
+ try {
+ do {
+ float_t score = 0.0f;
+ Term* t = enumerator->term();
+ if (t != null) {
+ score = enumerator->difference();
+ if (reusableST == NULL) {
+ reusableST = _CLNEW ScoreTerm(t, score);
+ } else if (score >= reusableST->score) {
+ // reusableST holds the last "rejected" entry, so, if
+ // this new score is not better than that, there's no
+ // need to try inserting it
+ reusableST->score = score;
+ reusableST->term = t;
+ } else {
+ continue;
+ }
+
+ reusableST = (ScoreTerm) stQueue->insertWithOverflow(reusableST);
+ }
+ } while (enumerator->next());
+ } _CLFINALLY({
+ enumerator->close();
+ _CLDELETE(enumerator);
+ }
+
+ BooleanQuery query = _CLNEW BooleanQuery(true);
+ int size = stQueue->size();
+ for(int i = 0; i < size; i++){
+ ScoreTerm* st = (ScoreTerm) stQueue->pop();
+ TermQuery* tq = new TermQuery(st.term); // found a match
+ tq->setBoost(getBoost() * st.score); // set the boost
+ query->add(tq, BooleanClause.Occur.SHOULD); // add to query
+ }
+
+ _CLDELETE(reusableST);
+
+ return query;
+ }*/
+
+
CL_NS_END
Modified: branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.h 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/search/FuzzyQuery.h 2008-10-10 10:47:49 UTC (rev 2936)
@@ -71,17 +71,19 @@
*/
size_t getPrefixLength() const;
+ //Query* FuzzyQuery::rewrite(IndexReader* reader)
+
protected:
FilteredTermEnum* getEnum(CL_NS(index)::IndexReader* reader);
};
- /** FuzzyTermEnum is a subclass of FilteredTermEnum for enumerating all
- * terms that are similiar to the specified filter term.
- *
- * Term enumerations are always ordered by Term.compareTo(). Each term in
- * the enumeration is greater than all that precede it.
- */
- class CLUCENE_EXPORT FuzzyTermEnum: public FilteredTermEnum {
+/** Subclass of FilteredTermEnum for enumerating all terms that are similiar
+ * to the specified filter term.
+ *
+ * <p>Term enumerations are always ordered by Term.compareTo(). Each term in
+ * the enumeration is greater than all that precede it.
+ */
+class CLUCENE_EXPORT FuzzyTermEnum: public FilteredTermEnum {
private:
float_t distance;
bool _endEnum;
@@ -119,10 +121,10 @@
int32_t editDistance(const TCHAR* s, const TCHAR* t, const int32_t n, const int32_t m) ;
protected:
- /**
- The termCompare method in FuzzyTermEnum uses Levenshtein distance to
- calculate the distance between the given term and the comparing term.
- */
+ /**
+ * The termCompare method in FuzzyTermEnum uses Levenshtein distance to
+ * calculate the distance between the given term and the comparing term.
+ */
bool termCompare(CL_NS(index)::Term* term) ;
///Returns the fact if the current term in the enumeration has reached the end
Modified: branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.cpp 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.cpp 2008-10-10 10:47:49 UTC (rev 2936)
@@ -93,6 +93,7 @@
buffer.append( _T(":"));
}
buffer.append(term->text());
+ // todo: use ToStringUtils.boost()
if (getBoost() != 1.0f) {
buffer.appendChar ( '^' );
buffer.appendFloat( getBoost(),1);
Modified: branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.h 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/search/MultiTermQuery.h 2008-10-10 10:47:49 UTC (rev 2936)
@@ -56,7 +56,7 @@
/** Prints a user-readable version of this query. */
TCHAR* toString(const TCHAR* field) const;
- Query* rewrite(CL_NS(index)::IndexReader* reader);
+ virtual Query* rewrite(CL_NS(index)::IndexReader* reader);
};
CL_NS_END
#endif
Modified: branches/lucene2_3_2/src/core/CLucene/search/Sort.h
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/search/Sort.h 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/search/Sort.h 2008-10-10 10:47:49 UTC (rev 2936)
@@ -32,34 +32,41 @@
// CL_NS(util)::Comparable** cachedValues;
// ScoreDocComparator(CL_NS(util)::Comparable** cachedValues);
- /**
- * Compares two ScoreDoc objects and returns a result indicating their
- * sort order.
- * @param i First ScoreDoc
- * @param j Second ScoreDoc
- * @return <code>-1</code> if <code>i</code> should come before <code>j</code><br><code>1</code> if <code>i</code> should come after <code>j</code><br><code>0</code> if they are equal
- * @see java.util.Comparator
+ /**
+ * Compares two ScoreDoc objects and returns a result indicating their
+ * sort order.
+ * @param i First ScoreDoc
+ * @param j Second ScoreDoc
+ * @return a negative integer if <code>i</code> should come before <code>j</code><br>
+ * a positive integer if <code>i</code> should come after <code>j</code><br>
+ * <code>0</code> if they are equal
+ * @see java.util.Comparator
*/
virtual int32_t compare (struct ScoreDoc* i, struct ScoreDoc* j) = 0;
- /**
- * Returns the value used to sort the given document. The
- * object returned must implement the java.io.Serializable
- * interface. This is used by multisearchers to determine how to collate results from their searchers.
- * @see FieldDoc
- * @param i Document
- * @return Serializable object
- */
+ /**
+ * Returns the value used to sort the given document. The
+ * object returned must implement the java.io.Serializable
+ * interface. This is used by multisearchers to determine how
+ * to collate results from their searchers.
+ * @see FieldDoc
+ * @param i Document
+ * @return Serializable object
+ */
virtual CL_NS(util)::Comparable* sortValue (struct ScoreDoc* i) = 0;
- /**
- * Returns the type of sort. Should return <code>SortField.SCORE</code>, <code>SortField.DOC</code>, <code>SortField.STRING</code>, <code>SortField.INTEGER</code>,
- * <code>SortField::FLOAT</code> or <code>SortField.CUSTOM</code>. It is not valid to return <code>SortField.AUTO</code>.
- * This is used by multisearchers to determine how to collate results from their searchers.
- * @return One of the constants in SortField.
- * @see SortField
- */
+ /**
+ * Returns the type of sort. Should return <code>SortField.SCORE</code>,
+ * <code>SortField.DOC</code>, <code>SortField.STRING</code>,
+ * <code>SortField.INTEGER</code>, <code>SortField.FLOAT</code> or
+ * <code>SortField.CUSTOM</code>. It is not valid to return
+ * <code>SortField.AUTO</code>.
+ * This is used by multisearchers to determine how to collate results
+ * from their searchers.
+ * @return One of the constants in SortField.
+ * @see SortField
+ */
virtual int32_t sortType() = 0;
/** Special comparator for sorting hits according to computed relevance (document score). */
Modified: branches/lucene2_3_2/src/core/CLucene/store/IndexInput.cpp
===================================================================
--- branches/lucene2_3_2/src/core/CLucene/store/IndexInput.cpp 2008-10-06 19:42:01 UTC (rev 2935)
+++ branches/lucene2_3_2/src/core/CLucene/store/IndexInput.cpp 2008-10-10 10:47:49 UTC (rev 2936)
@@ -149,6 +149,7 @@
}
}
+ //todo: support an extra parameter: bool useBuffer (as per JLucene)
void BufferedIndexInput::readBytes(uint8_t* b, const int32_t len){
if (len < bufferSize) {
for (int32_t i = 0; i < len; ++i) // read byte-by-byte
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|