In the Optimizely Search & Navigation admin view, administrators can set a certain weight of different properties (title, content, summary, or document content). When an user searches for a keyword that matches to a property’s value, the higher weight of that property will make the matching pages to be more likely to appear at the top of the search result.
Once you configured the weights, you can boost scores by calling a standard Unified Search method – UnifiedSearchFor:
var result = client.UnifiedSearchFor(searchText).GetResult();
Or calling UsingUnifiedWeights() with no parameters. This can also boost the scores based on the admin-defined weights.
var result = client.UnifiedSearch(Language.English).For(searchText).UsingUnifiedWeights().GetResult();
The problem:
However, in real life scenarios, those 4 out-of-the-box property weights in admin view are obviously not enough. For example, we want to boost the Author’s name of the Article Page when using search. How can we do that?
The solution:
Well, since these settings are not extensible, the work-around for this is using Boost with Filters for your search query. We will use BoostMatching extenstion method to boost the score of hits based on certain criteria, something like this:
query = query.BoostMatching(x => x.Author.MatchCaseInsensitive(searchText), 2);
This snippet above will work for a type-specific search. But in an unified search, where we search for multiple types and results are ISearchContent objects, we need an extra step:
query = query.BoostMatching(x => x.MatchTypeHierarchy(typeof(ArticlePage)) & ((ArticlePage)x).Author.MatchCaseInsensitive(searchText), 2);
The above will only boost ArticlePage that Author name matches the search text, other page types will be ignored in this boosting condition. And the boost weight of that matching condition is 2. According to the documentation, “The default property weight, 1, does not affect the score. A weight above 1 boosts the score if the information is in a corresponding property. A weight smaller than 1 reduces the score”.
You can wrap several boosting conditions into a search extension and call it from anywhere.
public static IQueriedSearch<ISearchContent, CustomFiltersScoreQuery> ApplyUnifiedSearchBoosting(this ITypeSearch<ISearchContent> baseSearchQuery, string searchText) { return baseSearchQuery .BoostMatching(x => x.MatchTypeHierarchy(typeof(ArticlePage)) & ((ArticlePage)x).Author.AnyWordBeginsWith(searchText), 2) .BoostMatching(x => x.MatchTypeHierarchy(typeof(ProductPage)) & ((ProductPage)x).ProductCode.MatchCaseInsensitive(searchText), 4); }
Ultimately, you can store your own weight values in your appsettings or in the CMS. I would prefer to store it in some kinds of Settings Page so they can be configurable.
“Your exploration of Optimizely Search & Navigation’s capabilities to enhance unified search is truly insightful! The integration of features like personalized search results, faceted navigation, and AI-driven recommendations promises to revolutionize the user experience and drive conversions. Your thorough analysis of how these functionalities can optimize search and navigation aligns perfectly with the needs of businesses striving to deliver relevant and seamless online experiences. As someone deeply invested in maximizing website performance, I appreciate the depth of your insights and look forward to seeing the real-world impact of these enhancements. Thanks for shedding light on the potential of Optimizely Search & Navigation to elevate unified search strategies!”
Myinstitutes.com is one of the Best Education Institutional Portal in Bangalore , Mysore and Mangalore.
Myinstitutes is a one-stop web portal for choosing the educational institutes,
training institutes or other courses in India and abroad. We are specialists in
providing you the finest information about training institutes as well their
ratings so that you can choose the most premium institute for education
that raises your career to a higher level.
This article has some detailed steps about how Optimizely Search Navigation which can surely supercharge user experience and get more conversions. More importantly, it is packed with practical tips and real-life stories that show exactly how to put it into action. It’s like getting a peek behind the curtain of successful search experiences. Thanks for sharing with us!