Solr - 搜索多个字段

时间:2012-10-31 21:04:47

标签: search solr global

我正在尝试允许在我的solr schema.xml中定义的所有字段进行全局搜索。我有以下字段:

     <field name="catchall" 
       type="text_en_splitting" 
       stored="true" 
       indexed="true"
       multiValued="true" />

然后,我有:

 <copyField source="*" dest="catchall"/>
 <defaultSearchField>catchall</defaultSearchField>

但是,当我在未指定字段的情况下进行搜索时,它只搜索此字段:

 <field name="text" type="text_en_splitting" multiValued="false"/>

我的配置是否缺少可在所有字段中搜索的内容?以下是默认搜索中未包含的字段示例:

<field name="summary" type="text_en_splitting" indexed="true" stored="true" multiValued="true"/>

1 个答案:

答案 0 :(得分:3)

我认为我发现了这个问题。显然,使用Solr 3.6.1,默认搜索字段在solrconfig.xml中指定,而不是在schema.xml中指定。在solrconfig.xml中,我将元素值从text更改为catchall。

<requestHandler name="/select" class="solr.SearchHandler">
 <lst name="defaults">
   <str name="echoParams">explicit</str>
   <int name="rows">10</int>
   <str name="df">catchall</str>
 </lst>
 </requestHandler>