0

While searching on azure using Rest API provided by Microsoft Search API Not behaving correctly when search string contains '@'.

Example: I've 3 rows in Azure Document CES CES@123 CES@1234

When My search string was CES* then all 3 were the result. When My Search string was CES@123* then only one exact matching record was in result. When My Search string was CES@* then there was no result.

As per my requirement in case of "CES@*" search string, all 3 records should be part of result set.

I've tried " "(space) in replacement of @ it works, but my data contains @ for search I need to maintain this.

I'm using SearchMode:Any.

johnnyRose
  • 7,310
  • 17
  • 40
  • 61

1 Answers1

0

This behavior is expected.

Query terms of prefix queries are not analyzed. Therefore, in your example with "CES@*" you are searching for term CES@ while the @ sign was stripped from the terms in the index: CES, 123, 1234.

Here is an excerpt from the How full text search works in Azure Search article:

Exceptions to lexical analysis

Lexical analysis applies only to query types that require complete terms – either a term query or a phrase query. It doesn’t apply to query types with incomplete terms – prefix query, wildcard query, regex query – or to a fuzzy query. Those query types, including the prefix query with term air-condition* in our example, are added directly to the query tree, bypassing the analysis stage. The only transformation performed on query terms of those types is lowercasing.

Yahnoosh
  • 1,932
  • 1
  • 11
  • 13