0
votes

I am new to the Microsoft Azure. I want to know how to do the partial text searching. I created azure cosmosdb and added some documents to the database through c#(To Insert the documents into the cosmosdb I followed the example in the given link: https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-get-started) and I created azure search resource, Import the data from cosmosdb to created index in azure search. I am getting the result for full-text search example.

query:
https://mysource.search.windows.net/indexes/documentdb-index/docs?api-version=2017-11-11&count=true&search=madhu  
Result:
  {
    "@odata.context": "https://mysource.search.windows.net/indexes('documentdb-index')/$metadata#docs(*)",
        "value": [
            {
                "@search.score": 1.4182854,
                "id": "Madhu_3",
                "LastName": "Madhu",
                "Parents": [
                    "{\"FamilyName\":null,\"FirstName\":\"Madhu\"}",
                    "{\"FamilyName\":null,\"FirstName\":\"Kalathuru\"}"
                ],
                "Children": [
                    "{\"FamilyName\":null,\"FirstName\":\"Henriette Thaulow\",\"Gender\":\"female\",\"Grade\":5,\"Pets\":[{\"GivenName\":\"Fluffy\"}]}"
                ],
                "IsRegistered": false,
                "rid": "W1wPAPoraMUDAAAAAAAAAA=="
            }
        ]
    }

But If I tried with partial text(like "ma") it reverts empty value. I gone through azure micro soft documents I found that I have to use custom analyzers for partial texting but I did n't understand how to use that?. Can anyone suggest me how to apply the custom analyzer to the fields? Thanks in advance.

2

2 Answers

0
votes

You could use custom analyzers for this by creating multiple tokens from each word. However, It would probably be better in this case to just use a wildcard search. Alternatively, Autocomplete and search suggestions are also useful to help users create the best query to find what they are looking for.

0
votes

There are 2 ways you can do this.

  1. You create synonyms and map with index fields (https://docs.microsoft.com/en-us/azure/search/search-synonyms-tutorial-sdk)
  2. Using custom skill set (azure function apps)