Hi,
When doing some debugging regarding #725142: Using word "to" causes error, I discovered a bug in the following code (around line 1170 of luceneapi.module):
if ($query instanceof Zend_Search_Lucene_Search_Query_Boolean) {
$subqueries = $query->getSubqueries();
if ($subqueries[0] instanceof Zend_Search_Lucene_Search_Query_Insignificant) {
$query = FALSE;
}
}
With a stopword-only query all subqueries will be "insignificant" query objects. The $query->getSubqueries() call should still work (which is interesting for the other issue), it will just return an array with only such insignificant query objects. This case is then caught by the next line.
However, if just the first key is a stopword, e.g. when searching for "is wonderful" (with "is" defined as a stopword), the warning is still displayed and the search not executed. The attached patch (I hope attaching works for once) will fix this.
The second patch additionally displays a message if some (but not all) keywords were ignored.
| Comment | File | Size | Author |
|---|---|---|---|
| luceneapi_stopword_recognition_with_notice.patch | 1.33 KB | drunken monkey | |
| luceneapi_stopword_recognition.patch | 1001 bytes | drunken monkey |
Comments
Comment #1
cpliakas commentedI really like the direction of these patches, and think they are a more complete fix to the ones applied to the 6.x-2.2 release. Flagging for adoption in 6.x-2.3. I haven't had a chance to thoroughly test them yet, but I will do so as soon as I get the time.
Thanks,
Chris
Comment #2
cpliakas commentedI applied the first patch, and it works perfectly. Thanks!
Comment #3
cpliakas commentedPatch committed at #391752.