Exact Meaning of "Slop" in Lucene SpanNearQuery (or slop in ElasticSearch span_near)
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.
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.
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.
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.