Issue Details (XML | Word | Printable)

Key: LUCENE-25
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Puk Witte
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

QueryParser produces empty BooleanQueries when all clauses are stop words

Created: 28/Mar/02 10:00 PM   Updated: 21/Aug/08 11:04 AM
Return to search
Component/s: QueryParser
Affects Version/s: 1.0.2
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works LUCENE-25.patch 2007-12-19 03:16 AM Grant Ingersoll 2 kB
Text File patch9.txt 2004-02-11 04:36 AM Jean-François Halleux 9 kB
Environment:
Operating System: All
Platform: PC
Issue Links:
Reference
 

Bugzilla Id: 7574
Resolution Date: 21/Aug/08 11:04 AM


 Description  « Hide
When I want to do the following query (example):
(fieldx : xxxxx OR fieldy : xxxxxxxx)AND(fieldx : stopword OR fieldy : stopword)
it will search (after passing the Analyzer including a StopFilter) for
(fieldx : xxxxx OR fieldy : xxxxxx) AND() and give a wrong searchresult or a
NullPointerException.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Otis Gospodnetic added a comment - 08/Nov/02 12:16 AM
That's interesting.
Does this happen even if you put spaces in the query 'properly', so that instead
of this:

(fieldx : xxxxx OR fieldy : xxxxxxxx)AND(fieldx : stopword OR fieldy : stopword)

you use:

(fieldx: xxxxx OR fieldy: xxxxxxxx) AND (fieldx: stopword OR fieldy: stopword)

Does it still happen?
If so, please include the stack trace, preferably with line numbers, so that we
know which code to fix.
Thanks.


Jean-François Halleux added a comment - 11/Feb/04 04:31 AM
We will try not to have to organize a party for the second birthday of this one.

Ok, the root cause for this is the QueryParser (once again), more specifically
getBooleanQuery which is returning an empty query even if there are no clauses.
When everything is a stopword, it could be the case that there are no clauses.

There are several possible fixes. Included in the attached is the less
disruptive one I could think of. It is "only" breaking three tests in
TestQueryParser.

However for the long term, I think that we should think of what it means to
parse an empty query ("") and what should be the expected result (null,"",
exception, ...)

Have fun,

Jean-Francois Halleux


Jean-François Halleux added a comment - 11/Feb/04 04:36 AM
Created an attachment (id=10302)
Fix elimination of empty query conjunction - careful this patch is cumulated with my previous regarding escapting character handling

Christoph Goller added a comment - 08/Sep/04 09:10 PM
      • Bug 9110 has been marked as a duplicate of this bug. ***

Hoss Man added a comment - 30/Aug/06 05:57 PM
revising title/component to better reflect real problem

Grant Ingersoll added a comment - 19/Dec/07 03:16 AM - edited
Attached patch adds a test to QP for this. It now seems like QP is doing reasonable things with stopwords at least for a few cases. Of course, I am not sure what QP should return when all the terms are stopwords (it currently returns a BooleanQuery with zero clauses)

I am not sure when this was fixed.
In other words, I would like to close this.


Doron Cohen added a comment - 21/Dec/07 04:06 PM
I think it is LUCENE-933 that fixed this one.

Aviran added a comment - 29/Apr/08 10:17 AM
This issue also affects version 2.2.0

Mark Miller added a comment - 21/Aug/08 11:04 AM
I don't know when this was fixed, but the example given now works, Grant's tests are already committed, and I think any QueryParser stop word issues that remain should get a new ticket. I don't think this one will help anything anymore.