2
votes

I have scenario where I have to search the Vendors using Vendor Names using Azure Search. For Example Below is the List Of Vendors.

  1. Infosys Technologies Limited
  2. Infosys BPM Limited
  3. Infor Solution
  4. Infosys Corporate Technologies
  5. Dell Computers
  6. First Infosystems

My Search Scenario is

  1. when Searchtext is Info it should return 1,2,3,4
  2. when Searchtext is Infosys it should return 1,2,4
  3. when Searchtext is Infosys Tech it should return only 1 not 4

I also tried keyword analyzer on Vendor Name Field and it also does not give the result I expected. Basically I want the searchtext to search from start of the Vendor Name field(startswith) and not on each word(Standard.Lucene Analyzer searches on every word) of Vendor Name Separately.

Can You Please Help me in this case on how to frame my query.

2
Hello. Have you found a solution?cache

2 Answers

1
votes

From Nate Ko's answer here:

It looks like you want to issue a prefix search query on the entire field value not on the individual terms in the fields. In such case, you need to use keyword analyzer so that the entire field value is tokenized into a single token. For example, given "16th Ave SE" as input, by default Azure Search uses standard analyzer and tokenizes the input into multiple terms as <16th>, , and the prefix search is issued on the tokenized terms. If you use the keyword analyzer instead, the entire field value is tokenized as the single token as <16th ave se> and a prefix search search=16th* will only find documents with field that starts with the prefix. Likewise, the suffix search via regex search=/.*ave/ will only find docs with fields that ends with the suffix. Below are related questions on stackoverflow.

http://stackoverflow.com/questions/40056213/behavior-of-asterisk-in-azure-search-service/40137948#40137948

http://stackoverflow.com/questions/40857057/how-to-practially-use-a-keywordanalyzer-in-azure-search

-1
votes

Both Simple query syntax and Lucene query syntax support prefix search queries like "prefix*"and find documents that contain terms that starts with the prefix query.

So you can try something like search=info*"&searchmode=all or search=infosys tech*&searchmode=all and it should work.

If you want even more advanced regular expression like searches, you can refer to Regular expression search