Solr - Query over all fields best practice

后端 未结 1 1828
猫巷女王i
猫巷女王i 2020-12-03 05:26

schema.xml snippet:

   
   

        
相关标签:
1条回答
  • 2020-12-03 06:07

    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.

    0 讨论(0)
提交回复
热议问题