solredismaxdismax

When to use edismax over dismax?


Solr supports dismax query parser and edismax query parser. How do we conclude when to use dismax and when edismax? When we should use edismax over dismax?


Solution

  • The reference guide documents this extensively.

    In addition to supporting all the DisMax query parser parameters, Extended Dismax:

    • supports the full Lucene query parser syntax.

    • supports queries such as AND, OR, NOT, -, and +.

    • treats "and" and "or" as "AND" and "OR" in Lucene syntax mode.

    • respects the 'magic field' names _val_ and _query_. These are not a real fields in the Schema, but if used it helps do special things (like a function query in the case of _val_ or a nested query in the case of _query_). If _val_ is used in a term or phrase query, the value is parsed as a function.

    • includes improved smart partial escaping in the case of syntax errors; fielded queries, +/-, and phrase queries are still supported in this mode.

    • improves proximity boosting by using word shingles; you do not need the query to match all words in the document before proximity boosting is applied.

    • includes advanced stopword handling: stopwords are not required in the mandatory part of the query but are still used in the proximity boosting part. If a query consists of all stopwords, such as "to be or not to be", then all words are required.

    • includes improved boost function: in Extended DisMax, the boost function is a multiplier rather than an addend, improving your boost results; the additive boost functions of DisMax (bf and bq) are also supported.

    • supports pure negative nested queries: queries such as +foo (-foo) will match all documents.

    • lets you specify which fields the end user is allowed to query, and to disallow direct fielded searches.

    Whether these features are important to you is up to your own use case, but in most cases there is no reason to use dismax over edismax - edismax is more flexible and fixes a few issues with dismax that has crept up over the years. Unless you have a very specific reason, go with edismax.