简体   繁体   中英

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

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

此功能已在solr 7中弃用: https ://lucene.apache.org/solr/guide/7_0/major-changes-in-solr-7.html建议使用df参数。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM