Solr - How to search in all fields without passing query field?

懵懂的女人 提交于 2019-12-25 16:03:11

问题


I have tried as below,

<field name="collector" type="text_general" indexed="true" stored="false"  multiValued="true" />

and copy all my fields to copyField as below,

<copyField source="fullname" dest="collector"/>
<copyField source="email" dest="collector"/>
<copyField source="city" dest="collector"/>

and also I have put all copyField tags below

<fields>

</fields>

tags. But I cant search in all fields. I have to pass fullname before query like,

q=fullname:Mayur

I want search by,

q=Mayur

And I should search all fields contains Mayur word.

Help me please


回答1:


make sure the fields have stored=true

<field name="field_name" type="text_general" indexed="true" stored="true"/>

True if the value of the field should be retrievable during a search.

Use the Default Search Field : The is used by Solr when parsing queries to identify which field name should be searched in queries where an explicit field name has not been used.

<defaultSearchField>collector</defaultSearchField>

in your schema.xml




回答2:


This has been deprecated in solr 7: https://lucene.apache.org/solr/guide/7_0/major-changes-in-solr-7.html It's recommended to use df parameter.



来源:https://stackoverflow.com/questions/30002255/solr-how-to-search-in-all-fields-without-passing-query-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!