Developer forum

Forum » Swift » Prioritizing product by product name in search result

Prioritizing product by product name in search result

Yoon Peti Nwe Dynamicweb Employee
Yoon Peti Nwe
Reply

Dear Forum,

I would like to get some advice on the search result whether we can prioritize when displaying products in the search result list.

Currently we are using Swift and when customer keying in the search keyword (for eg., "Essence") then in the search result, all of the products which include the value Essence in any of the product field will display automatically in the search result page.

However we would like to prioritize the products where product name include the search keyword first and then the rest.

Could you please advice is there any way to acheive this?

 

 

Thanks,

Yoon


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

I believe Standard Swift will do this already - at least current version.

In the query, 2 specific fields for product name and productnumber is part of the search using "Equal" statement - being "Equal" and not "Contains" in this situation is very important as using "Contains" will cause scoring to not work.

In the index, these 2 fields are added using boost:

Productname field like this using boost 5 - product number uses boost 10 and the field is not analyzed.

If you follow this setup, and do not apply another sorting than "Score" in your query, it should work as you request.

You can provide a URL if you want us to look at it.

 
Yoon Peti Nwe Dynamicweb Employee
Yoon Peti Nwe
Reply

Dear Nicolai,

Thank you for your quick response.

We already have all those setting that you are mentioned inside the product respository but it didn't work. Is it because of the version of Swift? 

Our version now is 1.14.1. 

Thanks,

Yoon

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

And what about the sorting on the query and on the paragraph - how do they look? It has to be sorted by score.

You are also not showing the product that is not on top of the result - how does that look?

 
Yoon Peti Nwe Dynamicweb Employee
Yoon Peti Nwe
Reply

Dear Nicolai,

Sorting have only "Score". I had attached the url for the site, if you don't mind could you please able to have a look?

https://rb.gy/bfyqop

Thanks,

Yoon

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

You have set your score to sort by "Ascending" meaning lower values are first and higher values last.

You need to sort "Descending" since high scores are better matches.

BR Nicolai

 

You must be logged in to post in the forum