The Lucid query parser offers a wide range of configuration settings, called request parameters that can be set in the Solr configuration XML file, solrconfig.xml (solrconfig.xml is specific to each collection. If using collection1, solrconfig.xml will be found in $LWE_HOME/conf/solr/cores/collection1_0/conf). After editing solrconfig.xml, LucidWorks Enterprise should be restarted. On some Windows systems, it may be necessary to stop LucidWorks Enterprise before editing any configuration file.
First, locate the "/lucid" request handler, which appears as follows:
Next, locate the "defaults" entry, which appears as:
Not all of the configuration settings will be present in solrconfig.xml. If not present, the settings will default to internal default settings. In general, solrconfig.xml is used to override internal default settings.
Before adding an override setting you should scan the existing settings to see if there is already a setting that can be modified. If none is present, add a new entry for the setting as detailed below. The order of the settings does not matter, so new settings can simply be inserted after the "defaults" entry.
Each configuration setting entry has the following format:
where sname is the name of the setting, as detailed below, and svalue is the value of the setting. The setting value does not use quotes, even for string values.
A number of settings are Boolean on/off settings, where a value of true indicates that the setting is "on" or enabled, and false indicates that the setting is "off" or disabled.
The q.alt setting specifies a default query to be used if the input query passed to the Lucid query parser is empty. By default, this setting is *:*, which selects all documents, which is equivalent to placing this entry in the request "defaults" in solrconfig.xml:
To disable this behavior and simply select no documents to return no query results, use an entry as follows:
The leadWild setting controls whether leading wildcards are permitted in queries. By default, this setting is "on" or enabled, which is equivalent to placing this entry in the request "defaults" in solrconfig.xml:
To disable leading wildcards, turn this setting off, with an entry as follows:
The Lucid query parser defaults to handling queries of up to 64K (65,536) characters in length. This should be sufficient to support even the most demanding of applications. But, should even this not be sufficient, configuration settings in solrconfig.xml may be added or modified to override these limits. In other cases, it may be desirable to dramatically decrease these limits to prevent rogue users from overloading the query/search servers in high-volume applications.
Here are the four configuration parameters that control maximum query length and their default values:
- maxQuery = 65,536 – Maximum length of the source query string (64K).
- maxTerms = 20,000 – Maximum number of terms in the source query string.
- maxGenTerms = 100,000 – Maximum number of Lucene Query terms that will be generated.
- maxBooleanClauses = 100,000 – Maximum number of Lucene Boolean Clauses that can be generated for a single BooleanQuery object. This includes original source terms, plus relevance-boosting phrases that are automatically generated.
Those default settings do not normally appear in solrconfig.xml, but if they did they would appear as follows:
If you wish to reduce the query length limit for maximum throughput of "casual" queries, a query length of 1,000 and 200 terms might be appropriate, which would require entries as follows:
The nearSlop setting controls the default distance limit for the NEAR, BEFORE, and AFTER proximity operators. The internal default is 15, which is equivalent to placing this entry in the request "defaults" in solrconfig.xml:
The default distance can be changed to 10, for example, with an entry as follows:
The NOT keyword operator is a special case among the keyword operators since "not" is such a common word in natural language text and would be too easily confused with "not" as a keyword operator. For this reason, the NOT operator must be all upper case, unless the notUp request parameter is disabled to allow "not" as a lower case operator.
The notUp setting controls whether the NOT operator keyword must be all upper case. A setting of true means that the NOT keyword must be all upper case to be considered as an operator rather than as a simple text term. A setting of false means that the NOT operator keyword may be lower case or upper case, or even mixed case. The internal default is true, meaning that all upper case is required for the NOT operator keyword, which is equivalent to placing this entry in the request "defaults" in solrconfig.xml:
Lower case or mixed case for the NOT operator keyword can be enabled with an entry as follows:
The opUp setting controls whether operator keywords, such as AND, OR, and NEAR, must be upper case. A setting of true means the keywords must be all upper case to be considered as operators rather than simple text terms. A setting of false means that operator keywords may be lower case or upper case, or even mixed case. The internal default is false, meaning that upper case is not required, which is equivalent to placing this entry in the request "defaults" in solrconfig.xml:
Operator keywords can be required to be all upper case with an entry as follows:
The NOT keyword operator is a special case since "not" is such a common word in natural language text and would be too easily confused with "not" as a keyword operator. For this reason, the NOT operator must be all upper case, unless the separate parameter, notUp, is disabled to allow "not" as a lower case operator.
The minMatch configuration setting controls the minimum percentage of optional terms of a simple Boolean query that must match for a document to be selected. This configuration setting is used as the default unless the user explicitly uses the minMatch (or atLeast) keyword option or the tilde ('~') modifier on a simple Boolean query in the query string. A setting of 0 (the default) means that none of the optional terms is required for a document match. A value of 100 means that all optional terms must match. As a special case, any small percentage, such as 1, means that at least one optional term must match in any simple Boolean query. The default value of 0 is equivalent to placing this entry in the request "defaults" in solrconfig.xml:
To assure that at least one optional term matches in every simple Boolean query, use an entry as follows:
To require half (50%) of the optional terms to match in simple Boolean queries, use an entry as follows: