When we say SLOP means the distance between two terms before they are a match, how exactly are slops calculated in a RediSearch query?
AFAIK SLOP used with Phrase match queries in RediSearch. It allows to specify a distance between words.
Using slop parameter you can search records with some additional deviations that include the terms in your original Phrase match.
Example: we have following records in field1
- 1 bed room
- 1 bed room kitchen
- 1 bed room balcony kitchen
- 1 bed room hall kitchen
if you search for “1 bed room” and do not pass slop you will get 1st recordset.
if you search for “1 bed room” and do pass slop as 1 then you will get 1st two recordsets
if you search for “1 bed room” and do pass slop as 2 then you will get all recordsets
Also important to note that score values will be scoring high to lower as per slop between exact match to partial match (between words)
When you add pass large slop value to search against fields which has longer content, such as descriptions (and not title), you return data that border view.
Hope this helps
Thank you @suyog for the explanation.
Yea, your explanation does help.
I will like to further ask that from the examples provided, which terms are we then calculating the distance on.
For the first example, I think I grasp that since the SLOP of exact match is zero but the others doesn’t seem so clear yet.