This post explains filtering and scoring Search Service Results. Part 1 post on azure search service can be read here.Filters uses OData expression for searching the documents. The sample filter using postman as follows

Filtering results

The following ODATA filter operators that you can use filtering data in Search Service

eq , ne, gt, lt, ge, le  – for comparison operations

and , or , not – for logical operations

You can use Any and All operators to search data in collections. example “Any” operator returns true when any string in the collection is matched. “All”  operator returns true when every string in the collection is matched.

Creating Scoring Results

Azure search returns more relevant results from index using score. Higher the score the more relevant to the document. AZURE Search uses TF-IDF (Term Frequency – Inverse Document Frequency) algorithm to score the documents.

You need to get search index definition to create scoring profile

    "scoringProfiles": [
        {   "name": "NickName1",
            "text":{
            "weights": {
            "NickName1":4
                        }    
                   }
       }
        ]

The above code tells which field to boost and by how much weight. Greater the value for weight higher in search results relevance. You can specify multiple field names in weights section as coma separated to include in scoring. Each searchable field has a default weight value 1.


Leave a Reply

Your email address will not be published. Required fields are marked *