0
votes

Please ignore the whitespace you see between title parenthesis.

Below query returns 94 records: (Expectation: titles containing word pregnancy) - PASSED

title:(pregnancy)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

Below query returns 3 records: (Expectation: titles containing word pregnant) - PASSED

title:(pregnant)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

Below query returns 97 records: (Expectation: titles containing words that start with preg) - PASSED

title:(preg*)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

Below query returns 3 records: (Expectation: titles containing words that start with preg and end with nt) - PASSED

title:(preg*nt)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

Below query returns 3 records: (Expectation: titles containing words that start with preg and end with t) - PASSED

title:(preg*t)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

Below query returns 0 records: (Expectation: titles containing words that start with preg and end with cy) - FAILED - Excepted at least 94 records

title:(preg*cy)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

Below query returns 0 records: (Expectation: words that start with preg and end with y) - FAILED - Excepted at least 94 records

title:(preg*y)&$count=true&queryType=full&searchMode=any&$skip=0&$top=12

I read these two articles: Lucene query syntax in Azure Search and How full text search works in Azure Search

I am almost ready to believe the * in above queries acts like a prefix operator, meaning, finding the words that start with "preg", instead acting like a wildcard search indicator.

Does anyone have any suggestions as to how to rewrite my queries to include titles that "start with certain" characters, and "end with certain" characters in the search results? Can I not use wildcard character * for this purpose?

Please do not get hung up on the term "pregnancy", I have used other words for searches as well, like "potato", "tomato", "exercise", "cancer", etc.

1

1 Answers

0
votes

I had created a ticket for Microsoft. Their suggestion was to change Azure Search Analyzer from "English Lucene" to "English Microsoft".

The explanation was that "English Lucene" automatically stems last character from a word.

You can see the differences here: Azure Search Analyzer Demo

Whether this is correct approach or not, it is debatable. Changing the analyzer did serve my purpose... for now.

enter image description here