{"version":"1.0","provider_name":"Aeologic Blog","provider_url":"https:\/\/www.aeologic.com\/blog","title":"The DisMax Query Parser - Ultimate Solr Guide - Aeologic Blog","type":"rich","width":600,"height":338,"html":"<blockquote class=\"wp-embedded-content\" data-secret=\"KLivNZoHs6\"><a href=\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide15-the-dismax-query-parser\/\">The DisMax Query Parser &#8211; Ultimate Solr Guide<\/a><\/blockquote><iframe sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/www.aeologic.com\/blog\/ultimate-solr-guide15-the-dismax-query-parser\/embed\/#?secret=KLivNZoHs6\" width=\"600\" height=\"338\" title=\"&#8220;The DisMax Query Parser &#8211; Ultimate Solr Guide&#8221; &#8212; Aeologic Blog\" data-secret=\"KLivNZoHs6\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><script>\n\/*! This file is auto-generated *\/\n!function(d,l){\"use strict\";l.querySelector&&d.addEventListener&&\"undefined\"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!\/[^a-zA-Z0-9]\/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret=\"'+t.secret+'\"]'),o=l.querySelectorAll('blockquote[data-secret=\"'+t.secret+'\"]'),c=new RegExp(\"^https?:$\",\"i\"),i=0;i<o.length;i++)o[i].style.display=\"none\";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute(\"style\"),\"height\"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):\"link\"===t.message&&(r=new URL(s.getAttribute(\"src\")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener(\"message\",d.wp.receiveEmbedMessage,!1),l.addEventListener(\"DOMContentLoaded\",function(){for(var e,t,s=l.querySelectorAll(\"iframe.wp-embedded-content\"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute(\"data-secret\"))||(t=Math.random().toString(36).substring(2,12),e.src+=\"#?secret=\"+t,e.setAttribute(\"data-secret\",t)),e.contentWindow.postMessage({message:\"ready\",secret:t},\"*\")},!1)))}(window,document);\n\/\/# sourceURL=https:\/\/www.aeologic.com\/blog\/wp-includes\/js\/wp-embed.min.js\n<\/script>\n","thumbnail_url":"https:\/\/www.aeologic.com\/blog\/wp-content\/uploads\/2020\/06\/The-DisMax-Query-Parser-in-solr.png","thumbnail_width":1080,"thumbnail_height":622,"description":"The DisMax query parser is designed to process simple phrases (without complex syntax) entered by users and to search for individual terms across several fields using different weighting (boosts) based on the significance of each field. Additional options enable users to influence the score based on rules specific to each use case (independent of user input). In general, the DisMax query parser\u2019s interface is more like that of Google than the interface of the &#8216;lucene&#8217; Solr query parser. This similarity makes DisMax the appropriate query parser for many consumer applications. It accepts a simple syntax, and it rarely produces error messages. The DisMax query parser supports an extremely simplified subset of the Lucene QueryParser syntax. As in Lucene, quotes can be used to group phrases, and +\/- can be used to denote mandatory and optional clauses. All other Lucene query parser special characters (except AND and OR) are escaped to simplify the user experience. The DisMax query parser takes responsibility for building a good query from the user\u2019s input using Boolean clauses containing DisMax queries across fields and boosts specified by the user. It also lets the Solr administrator provide additional boosting queries, boosting functions, and filtering queries to artificially affect the outcome of all searches. These options can all be specified as default parameters for the request handler in the&nbsp;solrconfig.xml&nbsp;file or overridden in the Solr query URL. Interested in the technical concept behind the DisMax name? DisMax stands for Maximum Disjunction. Here\u2019s a definition of a Maximum Disjunction or &#8220;DisMax&#8221; query: A query that generates the union of documents produced by its subqueries, and that scores each document with the maximum score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries. Whether or not you remember this explanation, do remember that the DisMax Query Parser was primarily designed to be easy to use and to accept almost any input without returning an error. DisMax Query Parser Parameters In addition to the common request parameters, highlighting parameters, and simple facet parameters, the DisMax query parser supports the parameters described below. Like the standard query parser, the DisMax query parser allows default parameter values to be specified in&nbsp;solrconfig.xml, or overridden by query-time values in the request. The sections below explain these parameters in detail. q Parameter The&nbsp;q&nbsp;parameter defines the main &#8220;query&#8221; constituting the essence of the search. The parameter supports raw input strings provided by users with no special escaping. The + and &#8211; characters are treated as &#8220;mandatory&#8221; and &#8220;prohibited&#8221; modifiers for terms. Text wrapped in balanced quote characters (for example, &#8220;San Jose&#8221;) is treated as a phrase. Any query containing an odd number of quote characters is evaluated as if there were no quote characters at all. q.alt Parameter If specified, the&nbsp;q.alt&nbsp;parameter defines a query (which by default will be parsed using standard query parsing syntax) when the main q parameter is not specified or is blank. The&nbsp;q.alt&nbsp;parameter comes in handy when you need something like a query to match all documents (don\u2019t forget&nbsp;&amp;rows=0&nbsp;for that one!) in order to get collection-wide faceting counts. qf (Query Fields) Parameter The&nbsp;qf&nbsp;parameter introduces a list of fields, each of which is assigned a boost factor to increase or decrease that particular field\u2019s importance in the query. For example, the query below: qf=\"fieldOne^2.3 fieldTwo fieldThree^0.4\" assigns&nbsp;fieldOne&nbsp;a boost of 2.3, leaves&nbsp;fieldTwo&nbsp;with the default boost (because no boost factor is specified), and&nbsp;fieldThree&nbsp;a boost of 0.4. These boost factors make matches in&nbsp;fieldOne&nbsp;much more significant than matches in&nbsp;fieldTwo, which in turn are much more significant than matches in&nbsp;fieldThree. mm (Minimum Should Match) Parameter When processing queries, Lucene\/Solr recognizes three types of clauses: mandatory, prohibited, and &#8220;optional&#8221; (also known as &#8220;should&#8221; clauses). By default, all words or phrases specified in the&nbsp;q&nbsp;parameter are treated as &#8220;optional&#8221; clauses unless they are preceded by a &#8220;+&#8221; or a &#8220;-&#8220;. When dealing with these &#8220;optional&#8221; clauses, the&nbsp;mm&nbsp;parameter makes it possible to say that a certain minimum number of those clauses must match. The DisMax query parser offers great flexibility in how the minimum number can be specified. The table below explains the various ways that mm values can be specified. Syntax Example Description Positive integer 3 Defines the minimum number of clauses that must match, regardless of how many clauses there are in total. Negative integer -2 Sets the minimum number of matching clauses to the total number of optional clauses, minus this value. Percentage 75% Sets the minimum number of matching clauses to this percentage of the total number of optional clauses. The number computed from the percentage is rounded down and used as the minimum. Negative percentage -25% Indicates that this percent of the total number of optional clauses can be missing. The number computed from the percentage is rounded down, before being subtracted from the total to determine the minimum number. An expression beginning with a positive integer followed by a &gt; or &lt; sign and another value 3&lt;90% Defines a conditional expression indicating that if the number of optional clauses is equal to (or less than) the integer, they are all required, but if it\u2019s greater than the integer, the specification applies. In this example: if there are 1 to 3 clauses they are all required, but for 4 or more clauses only 90% are required. Multiple conditional expressions involving &gt; or &lt; signs 2&lt;-25% 9&lt;-3 Defines multiple conditions, each one being valid only for numbers greater than the one before it. In the example at left, if there are 1 or 2 clauses, then both are required. If there are 3-9 clauses all but 25% are required. If there are more then 9 clauses, all but three are required. When specifying&nbsp;mm&nbsp;values, keep in mind the following: When dealing with percentages, negative values can be used to get different behavior in edge cases. 75% and -25% mean the same thing when dealing with 4 clauses, but when dealing with 5 clauses 75% means 3 are required, but -25% means 4 are required. If the calculations based on the parameter [&hellip;]"}