Solr文本字段和字符串字段-不同的搜索行为 [英] Solr Text field and String field - different search behaviour
问题描述
我正在研究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并应用了分析或过滤器,则可以使用TextField
和KeywordTokenizer
来实现.
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文本字段和字符串字段-不同的搜索行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!