0

I have a Azure search index containing address information of users with fields and corresponding weights as follows:

weights= @{  
                              HouseNumber = '40'      
                              StreetName = '36'
                              City = '30'
                              PostalCode = '29'
                              Province = '25'
                              Country = '21'
                              FSA = '20'      
                              Plus4 = '16'
                              SuiteName = '12'
                              SuiteRange = '11'
                              StreetPost = '10'
                              StreetPre = '8'
                              StreetSuffix = '6'
                            }

I am using searchmode as any for querying. How can I decide, that the record with max score is the most relevant one? Means, in case, the user doesn't enter all the keywords of the address, The relevance of the records may vary. E.g., if the string contains keywords like, '1A1' which can be part of the postal code 'A1A 1A1' or may be a housenumber. This will return both the records, but with different scores. How should I fix this?

Vivek Sharma
  • 87
  • 2
  • 7

1 Answers1

0

If a query's terms can match multiple fields (e.g. if '1A1' can match results in the PostalCode and the HouseNumber field), then the scoring profile would be working as expected by boosting each respective result.

You should instrument the application so the query is field-scoped. That way, each part of the query is searching against the proper field and the matches are boosted accordingly.

ashmaka
  • 71
  • 3
  • The problem is if the fields are not on the correct field when creating the field scope. These queries are created by the end users which may commit human error. So, in that case, the query won't work. Also, there may be case that some parts of the search query can be null or may have extra values. e.g. if query has the full address, but not the country where as the database will contains the country. Further, if the query specifies a specific street name in query, but our database had that field as null for the desired result. – Vivek Sharma Jul 20 '17 at 12:26
  • In the case where the query is missing information (e.g. If a query does not include the PostalCode), field-scoped queries will not return irrelevant results as no search would be executed on that field. When the document in the index is missing information (e.g. If a query includes a HouseNumber, and the HouseNumber field is empty in the result), then the field scoped query should still return relevant results based on the other fields (i.e. StreetName, Province, etc) even though it will not match the specific HouseNumber. Features like synonyms and fuzzy search can help mitigate human error. – ashmaka Jul 21 '17 at 00:58
  • But how can human errors that involve wrong field mappings be handled? – Vivek Sharma Jul 21 '17 at 11:53
  • What exactly do you mean by human error? In the UX of the application, you can have a separate search box or drop down menu for street address, city, province, country, postal code, etc. The user enters the address into the address field, the postal code into the postal code field, and so on. Then, when constructing the query to send to Azure Search, the application can use the proper field-scoped queries for each field. – ashmaka Jul 24 '17 at 00:57