Skip to content

Cleanup query parsing, remove QueryParser in favor of AdvancedQueryParser and TermGenerator

Stefan Brüns requested to merge work/bruns/cleanup_parser into master

The QueryParser handles two fairly distinct tasks, parsing of quoting characters, and splitting of phrases into terms.

The Phrase/Term splitting is similar to the TermGenerator, but slightly different. Using a different implementation for searching and DB storage can cause matching errors.

While the nested QueryParser quoting /can/ be used, it is fairly redundant, and problematic:

  • Quoting is already handled by the AdvancedQueryParser, which always sits in front of the SearchStore.
  • The QueryParser is only used for "contains" queries (e.g. filename:foo.png) not "equal" queries ("filename=foo.png").
  • Quoting of phrases for both variants is different, content:"'a b'" vs. content="a "b".
  • The QueryParser does not handle term truncation (see bug reference).

Use the TermGenerator in all cases, so term splitting and quoting is uniform.

The largest part of the MR are additional tests, and moving a few otherwise missing tests to the AdvancedQueryParser or TermGenerator tests.

CCBUG:412421

Merge request reports