Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

BoostMatch not working for category

Vote:
 

Hi!

So we have a recipe search page where an editor can choose e.g. christmas as the active category, and then we want all the recipes that are tagged with the category christmas to show up first.

I tried this: 

var searchResult = findClient.Search<RecipePage>(Language.Norwegian).BoostMatching(x => x.TypeCategory.Match(activeCategory.ToString()), 1).GetContentResult();

But it doesn't seem to work. It gives the exact same result as if I don't boost. If I filter on the same category, I get the recipes I want:

var searchResult = findClient.Search<RecipePage>(Language.Norwegian).Filter(x => x.TypeCategory.Match(activeCategory.ToString())).GetContentResult();

What am I doing wrong? Is there a better way to solve this?

#207978
Edited, Oct 09, 2019 15:41
Vote:
 

Can you try these suggestions for Match() method and see if that work? Also, have try in find boost UI to check if you are getting desired results?

#207979
Oct 09, 2019 15:48
Vote:
 

Hi,

Is your Episerver Find index contains the "Norwegian" language indexes?

If not then you can try by enabling the "Norwegian" language in Find or pass the "Language.None" in the query.

#208003
Oct 10, 2019 9:41
Vote:
 

Hi Torunn, 

Your code looks fine, but your boost weighting isn't enough to boost the results you're matching on I think. The docs state:

"The default property weight, 1, does not affect the score. A weight above 1 boosts the score if the information is found in a corresponding property. A weight smaller than 1 reduces the score."

https://world.episerver.com/documentation/developer-guides/find/NET-Client-API/searching/Boosting-with-weights/ 

Change to 2 and see if that helps :)

Thanks,

Paul

#208007
Oct 10, 2019 15:26
Praful Jangid - Oct 14, 2019 12:02
Good catch..
Vote:
 

It turned out to be what Paul suggested. I had misinterpreted the weighting, so I thought 1 was max. When I changed to 2, it worked.

Thanks everyone!

#208106
Oct 14, 2019 11:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.