“斜率”的确切含义在Lucene SpanNearQuery(或在ElasticSearch span_near中的斜率) [英] Exact Meaning of "Slop" in Lucene SpanNearQuery (or slop in ElasticSearch span_near)

查看:373
本文介绍了“斜率”的确切含义在Lucene SpanNearQuery(或在ElasticSearch span_near中的斜率)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题1: 在Lucene的 SpanNearQuery (或 span_near in ElasticSearch), slop 的确切含义是什么?是分开两个匹配单词的单词数,还是单词的分隔数加1?

Question 1: In Lucene's SpanNearQuery (or span_near in ElasticSearch), what is the exact meaning of slop? Is it the number of words separating the two matching words, or is it the separating number of words plus 1?

例如,假设您的索引文本是: foo bar biz

For example, suppose your indexed text is: foo bar biz

哪些查询将匹配此文本:foo biz〜0 foo biz〜1 foo biz〜2

Which queries would match this text: "foo biz"~0, "foo biz"~1, "foo biz"~2

我会期望第一个不匹配,最后一个会。但是中间呢?

I would expect that the first wouldn't match and the last would. But what about the middle?

问题2: 现在是第二个更复杂的推论问题: code> slop 如果有两个以上的搜索条款处理?它适用于每个对条款或任何对条款。

Question 2: Now a second and more complex corollary question: how is slop handled if there are more than two search clauses? Is it applied to each pair of clauses or any pair of clauses.

例如,假设您构建一个 SpanNearQuery 包含三个子句: foo bar ,code> BIZ 。需要匹配上述相同的索引文本?我会期望一个 2 的斜坡肯定会,但是如果 0 1

For example, suppose you construct a SpanNearQuery with three clauses: foo, bar, biz. What slop is needed to match the same indexed text above? I would expect a slop of 2 definitely would, but what about 0 or 1?

同样,使用相同的三条句子查询,需要匹配文本的方式: foo bar ble biz

Similarly, with the same three clause query, what slop is needed to match the text: foo bar ble biz

推荐答案

问题1: 分隔跨度子句的字数。所以倾斜0意味着它们是相邻的。在我给出的例子中,1的斜率将匹配。

Question 1: Slop is the number of words separating the span clauses. So slop 0 would mean they are adjacent. In the example I gave, slop of 1 would match.

问题2: 当有两个以上跨越子句,每个子句必须连接至少一个其他子句,不得超过分隔它们的斜体词,而且所有子句必须通过链接彼此连接。但是,每个条款都不需要以每个其他条款的斜线分隔。

Question 2: When there are more than two span near clauses, each clause must be connected to at least one other clause by no more than slop words separating them AND all of the clauses must be connected to each other through a chain. However, each clause need not be separated by slop words to every other clause.

对于问题2中的第一个例子:0,1和2的斜率将全部匹配。零匹配的斜率即使 foo biz 之间的分隔也不止一个,因为所有子句都有一条链。

For the first example in question 2: slop of 0, 1, and 2 would all match. Slop of zero matches even though foo and biz are separated by more than one because there is a chain through all clauses.

对于问题2中的第二个示例:0的坡度不匹配,因为 biz 与所有其他子句分开超过0个坡度。 1的Slop将匹配,因为 foo bar 分隔为0个斜率,另外 bar biz 分隔1个坡度。即使 foo biz 之间的分隔也是一样的,因为所有子句都有一条链。 2的Slop显然匹配。

For the second example in question 2: slop of 0 would not match because biz is separated from all other clauses by more than 0 slop. Slop of 1 would match because foo and bar are separated by 0 slop, in addition bar and biz are separated by 1 slop. It matches even though foo and biz are separated by more than one because there is a chain through all clauses. Slop of 2 would obviously match.

这篇关于“斜率”的确切含义在Lucene SpanNearQuery(或在ElasticSearch span_near中的斜率)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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