2011-10-10 102 views
0

我在模式中有几个多值字段,但是当我搜索应该从这些字段产生结果的条件时,没有结果返回。我没有在我的多值字段上找到匹配项

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

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

当我与这样的查询标签搜索...

{!dismax q.op=AND}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 

我无法找到类似的搜索问题,所以我觉得我一定错过了一些东西。任何人都可以将我指向正确的方向吗?

+0

CSV在数据库中是纯粹的邪恶。切勿使用它,因为它只会给你带来悲伤,缓慢,数据重复和其他痛苦。 – Johan

+0

数据库中没有CSV。我应该更清楚这是一个关于Solr的问题。多值字段对于在Solr中有一个具有可变数量值的字段(对于类似标签的东西)是必需的。 – tedders

回答

1

标签是否包含在可搜索字段列表中?
你正在寻找什么领域?你可能想添加标签。

由于您使用defType作为dismax,因此您可以尝试在url中传递qf = tags以测试名称为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> 

使用URL作为

q=test&qt=dismax 
+0

谢谢,在查询中添加“qf = tags”使我从标签字段获得结果。我可以发誓,我曾尝试过!我将设置一个具有默认字段的请求处理程序,并且可以解决问题。感谢你及时的答复! – tedders

相关问题