.netazureazure-cognitive-search

azuresearch search.ismatch is ignoring "1" at the end


I have following records -

{

"RoleDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117  pqr  1",

 "GroupDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117  Abc Xyz  1",

},

{

 "RoleDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117  pqr  1",

 "GroupDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117 Â Abc Xyz 1 Â 1",

},

{

"RoleDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117  pqr  1",

"GroupDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117 Â Abc Xyz 2 Â 1",

},

{

"RoleDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117  pqr  1",

"GroupDetails": "0AC05D80-B1E2-4E13-B1E7-602F6C272117  Abc Xyz 1 New  1",

}

1)

When I am using following filter -

&$filter=search.ismatch('Abc Xyz 1','GroupDetails','simple', 'all')

Returned = all records

Expecting = just two rows ("Abc Xyz 1" and "Abc Xyz 1 new")

2)

When I am using following filter -

&$filter=search.ismatch('Abc Xyz 2','GroupDetails','simple', 'all')

Returned = returning matched record i.e. one row ("Abc Xyz 2") which is expected

3)

But when using this filter -

&$filter=search.ismatch('Abc Xyz 1 new','GroupDetails','simple', 'all')

Returned = returning matched record i.e. one row ("Abc Xyz 1 new") which is expected

So why it is returning all records when searched "Abc Xyz 1" ?

Also note: I tried "simple" and "full" querytype

SOLUTION As per answer provided by Matthew Gotteiner, I modified the query like this -

&$filter=search.ismatch('"Abc Xyz 1"','GroupDetails','simple', 'all')

and it worked!


Solution

  • Since you are looking for exact phrases you should use the phrase search operator by surrounding your query in double quotes. For example, instead of searching for Abc Xyz 1, you can search for "Abc Xyz 1".

    Also, you only need to use the search.ismatch function if you are planning to combine the search with a filter using and. Otherwise, you can use the search parameter in the REST API or the searchText parameter in the .NET SDK