[sword-svn] r3916 - trunk/src/modules

scribe at crosswire.org scribe at crosswire.org
Mon Mar 9 17:55:03 EDT 2026


Author: scribe
Date: 2026-03-09 17:55:03 -0400 (Mon, 09 Mar 2026)
New Revision: 3916

Modified:
   trunk/src/modules/swmodule.cpp
Log:
Workaround bug in clucene with patch from Fr Cyrille <fr.cyrille at tiberiade.be> (+claude)


Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2026-03-09 20:44:22 UTC (rev 3915)
+++ trunk/src/modules/swmodule.cpp	2026-03-09 21:55:03 UTC (rev 3916)
@@ -550,7 +550,13 @@
 			Xapian::Query q = queryParser.parse_query(istr);
 			Xapian::Enquire enquire = Xapian::Enquire(database);
 #elif defined USELUCENE
-			q = QueryParser::parse((wchar_t *)utf8ToWChar(istr).getRawData(), _T("content"), &analyzer);
+			// Append a trailing space to work around a CLucene tokenizer bug where
+			// the last token is not finalized correctly without a following whitespace.
+			// This fixes: single +TERM searches, and some Unicode words (e.g. Greek LXX).
+			SWBuf istrPadded = istr;
+			istrPadded.append(' ');
+			q = QueryParser::parse((wchar_t *)utf8ToWChar(istrPadded).getRawData(), _T("content"), &analyzer);
+
 #endif
 			(*percent)(20, percentUserData);
 



More information about the sword-cvs mailing list