schema.xml snippet:
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="notes" type="text_general" indexed="true" stored="true"/>
<field name="missionFocus" type="text_general" indexed="true" stored="true"/>
<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="first_name" type="text_general" indexed="true" stored="true"/>
<field name="last_name" type="text_general" indexed="true" stored="true"/>
<field name="about_me" type="text_general" indexed="true" stored="true"/>
<field name="message" type="text_general" indexed="true" stored="true"/>
<field name="title" type="text_general" indexed="true" stored="true"/>
<field name="table_type" type="string" indexed="true" stored="true"/>
<field name="text" type="text_general" indexed="true" stored="false"
multiValued="true"/>
Now I want to search in all fields (except "id" and "table_type") for e.g. "hello". How I can do this? Do I really have to write following?
/solr/select/?q=notes:hello missionFocus:hello name:hello first_name:hello ..
I heard something about DisMaxRequestHandler but how I have to query with this handler? Do I need to change something in solrconfig.xml for that?
Trying a basic query The main query for a solr search is specified via the q parameter. Standard Solr query syntax is the default (registered as the “lucene” query parser). If this is new to you, please check out the Solr Tutorial. Adding debug=query to your request will allow you to see how Solr is parsing your query.
copyField uses the matching glob from the source field for the dest field name into which the source content is copied. Copying is done at the stream source level and no copy feeds into another copy. This means that copy fields cannot be chained i.e. you cannot copy from here to there and then from there to elsewhere .
Solr Queries Searching is the most powerful capability of Solr. Once we have the documents indexed in our repository, we can search for keywords, phrases, date ranges, etc. The results are sorted by relevance (score).
The best solution is to build a field, that collects the data of all fields like this
<field
name="collector"
type="text_general"
indexed="true"
stored="false"
multiValued="true"
/>
The only thing you have to do now is, copy the contents of all fields into that field:
<copyField source="notes" dest="collector"/>
<copyField source="missionFocus" dest="collector"/>
<copyField source="name" dest="collector"/>
....
Be aware that the copyField
block has to be defined BELOW this:
<fields>
....
</fields>
Now you can search only on the field collector
and you will find any text in any of your fields.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With