2
votes

I am facing a business requirement that states the order of words must be respected in proximity search. For example, if I search "A B~2", then only documents with "A B" should be returned, not documents with "B A".

It looks like Azure Search proximity search does not take the order of works into account. The JSFIDDLE link below demonstrates what I am referring to. The query searches quality analyst~5. It returns terms such as "Quality Oversight and Analyst" but it also returns terms such as "Senior Analyst, Quality and Data Management".

http://fiddle.jshell.net/liamca/gkvfLe6s/1/?index=nycjobs&apikey=252044BE3886FE4A8E3BAA4F595114BB&query=api-version=2016-09-01%26$count=true%26$select=business_title%26queryType=full%26search=business_title:%22quality%20analyst%22~5

is there support (current or future planned) for respecting "word order" in proximity search?

Thanks, Andres

1

1 Answers

2
votes

The proximity operator ~ defines how many transpositions of phrase query terms are allowed. Let's look at a few phrase queries and one document has three terms on subsequent positions: A B C

  • "A B" will match - this is equivalent to "A B"~0
  • "A C"~1 will match - term C moved forward by one position
  • "C B" won't match
  • "C B"~1 won't match - with only one allowed transposition we can move terms B and C to the same position
  • "C B"~2 will match - by allowing two transpositions the terms can reverse order of the phrase query terms

We don't have immediate plans to change this behavior, please vote on our User Voice page to help us prioritize.