本文介绍了Solr 文本字段和字符串字段 - 不同的搜索行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Solr 4+.

I am working on Solr 4+.

我的 solr 架构中有多个字段,具有不同的 solr 字段类型.

I have several fields into my solr schema with different solr field types.

文本字段和字符串字段的搜索是否不同?

Does the search on text field and string field differs?

因为我试图搜索无法按预期工作的字符串字段(它是几个方面字段的副本字段).目标字符串字段被索引并存储.

Because I am trying to search on string field (which is a copy field of few facet fields) which does not work as expected. The destination string field is indexed and stored both.

但是,当我更改文本字段(仅索引)的目标字段时,它工作正常.

However, when I change destination field which a text field (only indexed), it works fine.

你能说明为什么会发生这种情况吗?solr 中文本字段和字符串字段在搜索方面的区别是什么?

Can you suggest why this happens? What is exactly the difference between text and string fields in solr in respect to searches?

推荐答案

TextFields 通常附有分词器和文本分析,这意味着索引内容被分解为不需要的单独标记完全匹配 - 每个单词/标记可以单独匹配,以确定是否应将整个文档包含在响应中.

TextFields usually have a tokenizer and text analysis attached, meaning that the indexed content is broken into separate tokens where there is no need for an exact match - each word / token can be matched separately to decide if the whole document should be included in the response.

StrFields 不能应用任何标记化或分析/过滤器,并且只会给出完全匹配的结果.如果您需要应用分析或过滤器的 StrField,您可以使用 TextFieldKeywordTokenizer 来实现.

StrFields cannot have any tokenization or analysis / filters applied, and will only give results for exact matches. If you need a StrField with analysis or filters applied, you can implement this using a TextField and a KeywordTokenizer.

这篇关于Solr 文本字段和字符串字段 - 不同的搜索行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:23