On 11/16/2017 8:40 AM, Chuming Chen wrote: > I think the position is the issue, but how do I fix it? Is something wrong > with my index analyzer or just my query is not right? I need to do phrase > query, order is important here. > > I tried “KKS KSA”~1 in the query, it worked. However, if I do "KKS KSA > SAR”~1, it didn’t work, I had to do "KKS KSA SAR”~2. > > Is phrase slop essential here. I used to with Solr 3.5, no phrase slop is > needed.
The ~2 slop for the three-term query is correct -- because the third term will have position 3 on the query, and position 1 in the index, so it must adjust two places in order to match. If you look at the index analysis, you'll see that the positions of the 3 character ngrams are all the same. I believe this is typical for that filter, to maintain the position of the original term for all ngrams. It wouldn't surprise me to learn that version 3.5 had very different behavior in the ngram filter regarding positions, behavior that was considered incorrect and fixed. I think this might be the applicable issue: https://issues.apache.org/jira/browse/LUCENE-4955 Thanks, Shawn