solr的schema中几个特殊参数明细

来源:互联网 发布:深圳网站seo 编辑:程序博客网 时间:2024/06/13 13:41

positionIncrementGap

使用场景:multi-value field对应的phrase query场景

Suppose a document has a multi-valued “author” field. Like this:

author: John Doe
author: Bob Smith

With a position increment gap of 0, a phrase query of “doe bob” would
be a match. But often it is undesirable for that kind of match across
different field values. A position increment gap controls the virtual
space between the last token of one field instance and the first token
of the next instance. With a gap of 100, this prevents phrase queries
(even with a modest slop factor) from matching across instances.

我们当前的搜索场景不太需要phrase query的支持

precisionStep

使用场景:NumericRangeQuery,例如weight:[150 TO 600]

数值类型(int float double)在Lucene里都是以string形式存储的,当然这个string是经过编码的

经过编码后的string是保序的,也就是说num1>num2,那么strNum1>strNum2

precisionStep用来分解编码后的string,例如有一个precisionStep,默认是4,也就是隔4位索引一个前缀,比如0100,0011,0001,1010会被分成下列的二进制位“0100,0011,0001,1010“,”0100,0011,0001“,0100,0011“,”0100“。precisionStep这个值越大,那么索引树就越小,那么范围查询的性能(尤其是细粒度的范围查询)也越差;precisionStep这个值越小,索引树就越深,那么查询性能会提升,但是对应的空间复杂度就高了,一张图说明一切:

image

precisionStep大,就对应没有42,44,52,63,64那行,所以需要遍历的值就较多,效率较低

precisionStep小,就对应右侧如图,需要遍历的值只有423,641和642,其他的值在中间一层就都被找出来了,效率就高,相当于空间换时间

docValues

正排,多用于排序、facet、group以及自定义的精排和重排

omitNorms

在打分阶段排除文档长度的影响,正常的TF-IDF打分逻辑是同样命中一个term,如果文档A的term数量比文档B多,那么A的分数就比B低,在很多场景下需要剔除文档长度对打分的影响

sortMissingFirst

true:在sort时如果某个doc的这个field是空的,那么就优先出(first)
false:排序时当一个普通的空字符串进行处理

sortMissingLast

同上,只不过是空值排最后

原创粉丝点击