什么是“multiValued”的使用Solr中的字段类型? [英] What is the use of "multiValued" field type in Solr?

查看:107
本文介绍了什么是“multiValued”的使用Solr中的字段类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Apache Solr的新手。即使阅读了文档部分,我也发现很难清楚地理解<$ c $的功能和用法c> multiValued 字段类型属性。



内部Solr处理/处理/处理标记为 multiValued 的字段?



的字段与非字段的Solr在索引中的区别是什么?



有人可以用一些很好的例子来解释吗?

Doc说:

lockquote

multiValued = true | false



如果此
字段可能包含每个
文档的多个值, ,即它是否可以在文档中多次出现



解决方案

多值当字段中存在多个值时,字段非常有用。一个简单的例子就是标签,可能有多个标签需要被索引。所以如果我们将标记字段设置为多值,则solr响应将返回一个列表而不是字符串值。需要注意的一点是,您需要为每个标记的值提交多行:

 
< field name =tags> tag2< / tags>
...
< field name =tags> tagn< / tags>

一旦您拥有了所有的值索引,您就可以通过任何值e,g来搜索或过滤结果。您可以使用查询来查找所有包含tag1的文档,如

  q = tags:tag1 

或使用标签过滤掉结果,例如

  q = query& fq = tags:tag1 


I'm new to Apache Solr. Even after reading the documentation part, I'm finding it difficult to clearly understand the functionality and use of the multiValued field type property.

What internally Solr does/treats/handles a field that is marked as multiValued?

What is the difference in indexing in Solr between a field that is multiValued and those that are not?

Can somebody explain with some good example?

Doc says:

multiValued=true|false

True if this field may contain multiple values per document, i.e. if it can appear multiple times in a document

解决方案

A multivalued field is useful when there are more than one value present for the field. An easy example would be tags, there can be multiple tags that need to be indexed. so if we have tags field as multivalued the solr response will return a list instead of a string value. One point to note is that you need to submit multiple lines for each value of the tags like:

<field name="tags">tag1</tags>
<field name="tags">tag2</tags>
...
<field name="tags">tagn</tags>

once you have all the values index you can search or filter results by any value, e,g. you can find all documents with tag1 using query like

q=tags:tag1

or use the tags to filter out results like

q=query&fq=tags:tag1

这篇关于什么是“multiValued”的使用Solr中的字段类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆