Skip to content

Cannot change MatchQuery behaviour with 0 terms #2429

Closed
@chrismale

Description

@chrismale

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions