Reputation: 3
I have tried to run a single term search in Solr 9.0 through by using
q=term
(e.g. http://localhost:8983/solr/windowstest/select?indent=true&q.op=OR&q=yelp).
I've noticed that older versions of Solr were able to handle such a request but now I can only search all fields for that term by adding using OR
q=id:yelp OR subject:yelp OR body:yelp
(e.g. http://localhost:8983/solr/windowstest/select?indent=true&q.op=OR&q=id%3Ayelp%20OR%20subject%3Ayelp%20OR%20body%3Ayelp).
Is there a way to not have to indicate the fields?
Upvotes: 0
Views: 113
Reputation: 52892
There is no setting for "searching all fields"; however, what is usually done is to have a single field as the copyField
destination for all fields. You can do this by defining a catch-all field (by default named _text_
, and then configuring <copyField src="*" dest="_text_">
- making the content of all the fields get copied into _text_
.
You can then set the default search field (i.e. where there isn't a field name given) with the df
parameter in the query - the default field.
http://localhost:8983/solr/windowstest/selectq.op=OR&q=yelp&df=_text_
If you want to set this as the default, you configure it as a default parameter in solrconfig.xml
under the specific request handler:
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="df">_text_</str>
<int name="rows">10</int>
</lst>
</requestHandler>
.. or by using initparams:
<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell">
<lst name="defaults">
<str name="df">_text_</str>
</lst>
</initParams>
Upvotes: 0