I have a web-based frontend (localhost, currently) that uses Ajax to query Solr.
It's working well, but if I submit a single space (nothing else) in the input/search box, the URL in the browser shows
...#q=%20
and in that circumstance I get a 400 error
, and my web page stalls (doesn't refresh), apparently waiting for a response from Solr.
By comparison, if I submit a semicolon (;
) rather than a space, then the page immediately refreshes, albeit with no results (displaying 0 to 0 of 0
; expected).
My question is what is triggering the "
" (%20
) query fault in Solr, and how do I address it in solrconfig.xml
?
Update. This solrconfig.xml
entry resolved the q=%20
issue I described.
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="hl">off</str>
<str name="wt">html</str>
<str name="df">query</str>
<!-- *** ADDITION: *** -->
<str name="defType">edismax</str>
</lst>
</requestHandler>
Note: development code, dummy data.
Before: https://www.youtube.com/watch?v=GhkA4XlqWds&list=PLTtHvbtVBhk6zAqSJ3A1-shsD_h5i3IuP&index=2
After: https://www.youtube.com/watch?v=507DdPOx1xA&list=PLTtHvbtVBhk6zAqSJ3A1-shsD_h5i3IuP&index=1
Additional discussion (reddit:Solr): https://old.reddit.com/r/Solr/comments/kt97ql/solr_query_with_space_only_q20_gives_error/