Odata wildcard at the beginning instead of the end of query

Viewed 243

I know that you can do an odata query like this for wildcards

$filter=search.ismatch('lux*', 'Description')

What I would like to do is this

$filter=search.ismatch('*lux', 'Description')

I have tried the above query and it did not return any information and I know there are matches for '*lux'

Ideally I would like to have 2 different fields in the query like this

search=&$filter=Hotel eq 'Southern' and search.ismatch('*lux', 'Description')

That syntax does not return anything either

Ideal result set: Hotel: Description: Southern Ultra lux Southern Mega lux

Also I did not know how to tag this as I don't work with it a lot so I am sorry if it is mis tagged

2 Answers

I found this answer: You cannot use a * or ? symbol as the first character of a search. No text analysis is performed on wildcard search queries. At query time, wildcard query terms are compared against analyzed terms in the search index and expanded.

Looks like it isn't possible only if the wildcard is at the beginning of the search query. If the wildcard is at the end or middle of the search query then it will work perfectly.

You can do prefix, suffix and infix queries in Azure Cognitive Search if your queryType is set to "full" (invokes the full Lucene parser) and if you're using regular full text search ("search=") instead of a $filter. Prefix, suffix, and infix are variations of wildcard search forms. There are some examples in the docs if you want to take a look.

Related