简体   繁体   English

Solr返回成员是否在多值字段中

[英]Solr return whether member is in multivalued field

Is there any way to return in the fields list whether a value exists as one of the values of a multivalued field? 有什么方法可以在字段列表中返回一个值是否作为多值字段的值之一存在?

Eg, if your schema is 例如,如果您的架构是

<schema>
...
<field name="user_name" type="text" indexed="true" stored="true" required="true" />
<field name="follower" type="integer" indexed="true" stored="true" multiValued="true" />
...
</schema>

A sample document might look like: 示例文档可能如下所示:

<doc>
<field name="user_name">tester blah</field>
<field name="follower">1</field>
<field name="follower">62</field>
<field name="follower">63</field>
<field name="follower">64</field>
</doc>

I would like to be able to query for, say, "tester" and follower:62 and have it match "tester blah" and have some indication of whether 62 is a follower or not in the results. 我希望能够查询“ tester”和“ follower:62”,并使其与“ tester blah”匹配,并在结果中表明62是否是关注者。

If you query for something AND follower:62, you can be sure 62 will be a follower of any result you get :) 如果您查询某项AND跟随者:62,则可以确定62将成为您获得任何结果的跟随者:)

Now if follower:62 comes as an optional clause in a OR for instance, I guess you can use the highlighting facility to achieve your requirement. 现在,例如,如果follower:62作为OR中的可选子句出现,我想您可以使用突出显示功能来满足您的要求。

hl.field=...,follower,..
hl.requireFieldMatch= true

You'll get something in the highlighting part of the response for your document if it matches your follower:62. 如果文档与关注者匹配,您将在文档的突出显示部分中得到一些帮助:62。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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