Solr – Query over all fields best practice

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.

Leave a Comment