Requiring exact-phrase matches (((“proximity matching”, “slop parameter”)))may be too strict a constraint. Perhaps we do
want documents that contain quick fox,’’ even though the positions aren’t exactly equivalent.
We can introduce a degree (((“slop parameter”)))of flexibility into phrase matching by using theslop
parameter:
}
// SENSE: 120_Proximity_Matching/10_Slop.json
The slop
parameter tells the match_phrase
query how(((“matchphrase query”, “slop parameter”))) far apart terms are
allowed to be while still considering the document a match. By _how far
apart we mean how many times do you need to move a term in order to make
the query and document match?
Although all words need to be present in phrase matching, even when using slop
,
the words don’t necessarily need to be in the same sequence in order to
match. With a high enough value, words can be arranged in any order.
To make the query fox quick
match our document, we need a slop
of 3
:
Pos 1 Pos 2 Pos 3
Doc: quick brown fox
-----------------------------------------------
Slop 2: quick ↳ fox