自定义SOLR Request Handler查询报错,请求协助排查配置问题
Let's walk through the potential issues with your /globalmi-search-select handler configuration that might be causing the error when running a * query:
1. Edismax and Wildcard Query Compatibility
Your handler uses defType=edismax, which is great for advanced query boosting but has quirks with bare wildcard queries like q=*. Edismax expects structured query input, and a single * isn't a valid query expression for it by default.
Fix: Add a q.alt parameter to your defaults to handle empty or wildcard-style queries. This tells Solr to use a fallback query when the main q parameter is empty or unparseable:
<str name="q.alt">*:*</str>
This way, when you pass q=*, Solr will fall back to *:* (the correct syntax for matching all documents).
2. Minimum Match (mm) Parameter Edge Case
Your mm setting is 3<90% 6<75%, which defines how many query terms must match based on the total number of terms. But when running a *:* query, there are no terms to evaluate—this can confuse the edismax parser.
Fix: Add a default rule for when there are 0 terms. Update your mm parameter to:
<str name="mm">0% 3<90% 6<75%</str>
The 0% tells Solr that if there are no query terms (like in a wildcard match-all query), all documents should be considered a match.
3. Did You Reload Your Core?
After adding a new request handler to your solrconfig.xml, you need to reload the Solr core (via the Core Admin page in Solr Admin) or restart Solr entirely. If you skipped this step, the new handler isn't actually active, which would cause errors when trying to use it.
4. Verify Your Query Syntax
Make sure you're using the correct syntax for a match-all query. Instead of just q=*, use q=*:* directly in your Solr Admin query. The *:* syntax explicitly tells Solr to match all documents across all fields (or the default field defined by df).
Updated Handler Configuration Example
Here's how your handler might look with the fixes above:
<requestHandler name="/globalmi-search-select" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">10</int> <!-- ranking, boosting configuration --> <str name="defType">edismax</str> <str name="qf">title^3.0 content^2.0 authors^1.0</str> <str name="df">text</str> <str name="fl">*,score</str> <str name="mm">0% 3<90% 6<75%</str> <str name="q.alt">*:*</str> </lst> </requestHandler>
After updating the config, reload your core and try the query again—this should resolve the error.
内容的提问来源于stack exchange,提问作者Varun Chadha

