Why is Azure Cognitive Search prioritizing document content over name?

308 Views Asked by At

I have set up an Azure Cognitive Search, populated an index with documents from Blob Storage, and everything seems to work fine. The documents are there, and I can search for them, but for some reason the content of the document seems to be prioritized higher than the name of the document. I want the documents that includes the search term in the name to show up first, followed by documents that contain the search term in the content.

Here is an example of the response I get after searching for a single word: Search results

As you can see, the first hit gets a higher score than the others, even though the third hit also contains the search term in the name. I assume the second hit contains a lot of instances of the search term, but I still want name to be prioritized higher.

How can I achieve this?

Both name and content are searchable. I have tried adding a scoring profile with a weight to the name field, but doing this only seems to result in an even higher score for the first hit, and the other scores stay identical.

EDIT - Adding picture of scoring profile used for search.

In the original question, I had already added a scoring profile where metadata_storage_name was given a weight of 2. This was set to default, and removing it would drop the score of the first result to 8.3, while the others stayed identical. I have also tried "docs?search=betong&scoringProfile=FileNameBoost" this approach, although not necessary with the scoring profile set as default. By adding content to the scoring profile as well, the other results get a boost, but this is not what I want, as the name should be prioritized above content.

Scoring profile used in search

1

There are 1 best solutions below

4
Thiago Custodio On

You'll need to use scoring profiles to boost documents which contain the searched term in the name.

Here's the official doc with more information around it:

https://learn.microsoft.com/en-us/azure/search/index-add-scoring-profiles