SearchQueryParser class

Parses a search query language which is very similar to Lucene query language.

Examples of supported queries:

  • norwegian forest cat
    • Matches keywords "norwegian", "forest", and "cat".
  • "norwegian forest cat"
    • A quoted keyword ensures that the words must appear as a sequence.
  • cat AND dog
    • Matches keywords "cat" and "dog" (in any order).
  • cat OR dog
    • Matches keyword "cat", "dog", or both.
  • pet -cat
    • Matches keyword "pet", but excludes documents that match keyword "cat".
  • color:brown
    • Color matches keyword "brown".
  • color:="brown"
    • Color is equal to "brown".
  • weight:>=10
    • Weight is greater than or equal to 10.
  • weight:[10 TO 20]
    • Weight is between 10 and 20, inclusive.
  • weight:{10 TO 20}
    • Weight is between 10 and 20, exclusive.
  • (cat OR dog) AND weight:>=10
    • An example of grouping filters.

In equality and range expressions, the parser recognizes:

  • null
  • false, true
  • 3
  • 3.14
  • 2020-12-31 (Date)
  • 2020-12-31T00:00:00Z (DateTime)

For example:

  • weight:=10 --> MapFilter({'weight':ValueFilter(10)})
  • weight:="10" --> MapFilter({'weight':ValueFilter('10')})
  • weight:=10kg --> MapFilter({'weight':ValueFilter('10kg')})
  • weight:10 --> MapFilter({'weight':KeywordFilter('10')})




hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
parseFilter(SearchQueryParserState state) Filter
Parses all remaining tokens in the state.
parseFilterFromString(String s) Filter
Parses the string.
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]