Move handling of query only containing MUST_NOT to QueryParser (and remove QueryUtils.makeQueryable() hack in Solr) [LUCENE-3460]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
With the parent issue, users entering (a -b) into the queryparser can simply fail with an UnsupportedOperationException, if "a" is a stopword.
Solr already has a hack to add a MatchAllDocsQuery, if a query only contains prohibited clauses.
The other issue (not affecting prohibited clauses) with stopwords is: If the user enters (a the) into queryparser, the query will return no results, as "a" and "the" are stopwords. This confuses lots of people (not only developers, even ordinary users of our interfaces). If somebody queries for a stopword, the correct way to handle this is to return **all** documents (MatchAllDocsQuery).
A possible solution, as suggested by Chris Male on IRC was: Add a flag to QueryParser to enable a "no-should-or-must-clauses" mode, where this is replaced by MatchAllDocs automatically. This would also solve the prohibited clause case, too.
The stopword case is bad, but the opposite is as bad as returning all documents.
At least this issue should somehow handle the only-prohibited case like Solr and remove the hack from Solr.
Changing this in QueryParser is the more correct solution than doing this hidden in BQ.
---
Migrated from [LUCENE-3460](https://issues.apache.org/jira/browse/LUCENE-3460) by Uwe Schindler (@uschindler), updated May 09 2016
Parent: #4525
Contributor guide
Assessment
This issue has not been assessed yet.