Welcome to Voyager Help

Use the Search field below or select a Category from the list at the left

Solr Query Parsers

A Query Parser processes and interprets Solr search queries. 

The input to a query parser can include:

  • search stringsterms to search for in the index
  • parameters for fine-tuning the query by increasing the importance of particular strings or fields, by applying Boolean logic among the search terms, or by excluding content from the search results
  • parameters for controlling the presentation of the query response, such as specifying the order in which results are to be presented or limiting the response to particular fields of the search application's schema.

Different query parsers support different syntax. Solr's default query parser is known as the Standard Query Parser, or the lucene query parser. Solr also includes the DisMax and Extended DisMax (eDisMax) query parsers.

The Standard query parser's syntax allows for greater precision in searches, but the DisMax query parser is much more tolerant of errors. The DisMax query parser is designed to provide an experience similar to that of popular search engines such as Google, which rarely display syntax errors to users. The Extended DisMax query parser is an improved version of DisMax that handles the full Lucene query syntax while still tolerating syntax errors.

 By default, Voyager Search uses the eDisMax query parser.

List of Built-in Lucene Query Parsers

Some query parsers are built-in and will work out of the box. They are:

  • lucene - the default lucene parser
  • dismax - DisMax parser allows querying across multiple fields with different weights
  • edismax - ExtendedDisMax parser builds on dismax but with more features
  • maxscore - Same as lucene but returns max() score instead of sum 
  • func - create a function query
  • boost - boost a query by a function query
  • frange - functions as range filters, also see this intro blog
  • field - simple field query
  • prefix - simple prefix query
  • raw - create a term query from the input value without any text analysis or transformation whatsoever. This is useful in debugging, or when raw terms are returned from the terms component (this is not the default). also useful for debugging, or for avoiding query parser escaping madness when drilling into facets on text or string fields via fq parameters.
    Note: use "term" for this in Solr 4.0 or above. Example: &fq={!raw f=field_name}crazy+\"field+value 
  • term - term query, useful for avoiding query parser escaping madness when drilling into facets via fq parameters. Example: &fq={!term f=weight}1.5
  • surround - SurroundQueryParser provides rich SpanQuery or NEAR support 
  • simple - Simple query parser is used to parse human readable query syntax. 
  • complexphrase - ComplexPhraseQueryParser accepts operators inside phrases
  • query - nested query parsing 

Selecting a Query Parser

There are several ways to select which query parser to use for a certain request:

  • defType - The default type parameter selects which query parser to use by default for the main query. Example: &q=foo bar&defType=lucene
  • LocalParams - Inside the main q or fq parameter you can select a query parser using the localParam syntax. Example: &q={!dismax}foo bar 

See Also

Web Design and Web Development by Buildable