From: <ust...@us...> - 2009-07-08 09:57:29
|
Revision: 3016 http://clucene.svn.sourceforge.net/clucene/?rev=3016&view=rev Author: ustramooner Date: 2009-07-08 09:57:26 +0000 (Wed, 08 Jul 2009) Log Message: ----------- Fixed an issue with quoted terms in QP Modified Paths: -------------- branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParser.cpp branches/lucene2_3_2/src/test/queryParser/TestQueryParser.cpp Modified: branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParser.cpp =================================================================== --- branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParser.cpp 2009-07-08 09:56:41 UTC (rev 3015) +++ branches/lucene2_3_2/src/core/CLucene/queryParser/QueryParser.cpp 2009-07-08 09:57:26 UTC (rev 3016) @@ -1064,6 +1064,10 @@ catch (...) { /* ignore exceptions */ } } // TODO: Allow analysis::Term to accept ownership on a TCHAR* and save on extra dup's + + // TODO: Make sure this hack, save an extra dup, is legal and not harmful + const size_t st = _tcslen(term->image); + term->image[st-1]=NULL; TCHAR* tmp = discardEscapeChar(term->image+1); q = getFieldQuery(_field, tmp, s); _CLDELETE_LCARRAY(tmp); Modified: branches/lucene2_3_2/src/test/queryParser/TestQueryParser.cpp =================================================================== --- branches/lucene2_3_2/src/test/queryParser/TestQueryParser.cpp 2009-07-08 09:56:41 UTC (rev 3015) +++ branches/lucene2_3_2/src/test/queryParser/TestQueryParser.cpp 2009-07-08 09:57:26 UTC (rev 3016) @@ -164,8 +164,9 @@ assertQueryEquals(tc,tmp1, &a, tmp1); #endif - //assertQueryEquals(tc, _T("\"\""), &b, _T("")); - //assertQueryEquals(tc, _T("foo:\"\""), &b, _T("foo:")); + // TODO: Those 2 fail, related probably to the escape function + assertQueryEquals(tc, _T("\"\""), &b, _T("")); + assertQueryEquals(tc, _T("foo:\"\""), &b, _T("foo:")); assertQueryEquals(tc,_T("a AND b"), NULL, _T("+a +b")); assertQueryEquals(tc,_T("(a AND b)"), NULL, _T("+a +b")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |