什么时候使用 edismax 而不是 dismax?

When to use edismax over dismax?

Solr 支持 dismax 查询解析器和 edismax 查询解析器。我们如何得出何时使用 dismax 以及何时使用 edismax 的结论?我们什么时候应该使用 edismax 而不是 dismax?

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.

这些功能对您是否重要取决于您自己的用例,但在大多数情况下,没有理由使用 dismax 而不是 edismax - edismax 更灵活,并修复了 dismax 的一些问题这些年。除非你有非常具体的原因,否则请使用 edismax。