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

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

问题描述

我是 Apache Solr 的新手.即使在阅读了 documentation 部分之后,我还是发现很难清楚地理解 multiValued 的功能和使用 字段类型属性.

Solr 在内部做什么/处理/处理标记为 multiValued 的字段?

在 Solr 中,multiValued 的字段与非多值字段的索引有何不同?

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

医生说:

<块引用>

multiValued=true|false

如果这为真每个字段可能包含多个值文件,即如果它可以出现在一个文档中多次

解决方案

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

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

拥有所有值索引后,您可以按任何值搜索或过滤结果,例如您可以使用像

这样的查询找到所有带有 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 then 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天全站免登陆