我没有在我的多值字段上获得匹配

时间:2011-10-10 19:34:31

标签: search solr multivalue

我的架构中有几个多值字段,但是当我搜索应该从这些字段产生结果的字词时,没有结果返回。

例如,在我的架构中有一个像这样的多值字段:

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

当我使用像这样的查询搜索标签时......

{!dismax q.op=AND}test

我在单值字段中获得带有“test”的结果,但在多值字段中却没有。我转储了从搜索中回来的结果,以验证存储的内容。

(matches when I search "test")
name: TEST 4
description: i match the query "test"
year: 2010
id: 61

(does not match when I search "test")
name: BEST 4
description: i do not match the query
year: 2010
id: 68
tags: (array)
  0:test
  1:test2
  2:i'm a test

我无法通过搜索找到类似的问题,所以我觉得我一定错过了什么。有人能指出我正确的方向吗?

1 个答案:

答案 0 :(得分:1)

标签是否包含在可搜索字段列表中? 您正在搜索的字段是什么?你可能想要添加标签。

当您使用defType作为dismax时,您可以尝试在url中传递qf =标签,以测试是否返回名称为BEST 4的文档以及结果。

用于搜索名称,描述和标签的solrconfig.xml条目示例 -

<requestHandler name="dismax" class="solr.SearchHandler">
   <lst name="defaults">
     <str name="echoParams">explicit</str>
     <str name="defType">dismax</str>
     <str name="qf">
        name description tags
     </str>
     <str name="q.alt">*:*</str>
     <str name="rows">10</str>
     <str name="fl">*,score</str>
   </lst>
</requestHandler>

使用网址

q=test&qt=dismax