Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change MatchQuery behaviour with 0 terms #2429

Closed
chrismale opened this issue Nov 21, 2012 · 2 comments
Closed

Cannot change MatchQuery behaviour with 0 terms #2429

chrismale opened this issue Nov 21, 2012 · 2 comments

Comments

@chrismale
Copy link
Contributor

A common problem that arises in query parsing is what to do when analysis strips all the terms from the input string. For example, when the query is just "i" or even something more complex like "i AND you", stopword analysis will leave a clause without any terms.

In this situation, both Lucene and ElasticSearch view the clause as an empty-set of terms which matches nothing. However users often would prefer the clause to instead be a MatchAll Query, matching every document.

Currently MatchQuery has hardcoded behaviour that uses MatchNoDocsQuery in this situation. Instead we should allow users to provide a flag as part of a match query that gives them control over what to do when there is an empty-set clause.

@chrismale
Copy link
Contributor Author

Will add a flag zero_term_docs to the match query, which accepts two possible values, none which replicates the existing behaviour and will be the default and all which will create a MatchAllDocsQuery instead.

@chrismale
Copy link
Contributor Author

Added flag zero_terms_query in 2541847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant