"Random Relevance" sortby not randomizing "near me" results that share location

We have an insurance provider client who wants to have its agents sorted randomly in search results. There are a number of agents who work at the same location, but when we search based on that location, the results appear in a static order (e.g., when “agents in Omaha” is run, the same agent appears at the top of the list each time). We want this to be randomized for each search, so no one agent appears each time a location-based search is run.

In the configuration, Sortby is currently set to Random Relevance and does randomly sort the results in the experience preview. This, however, is not the case when running search on the staging URL and in the live production environment.

Does Random Relevance work for location queries, or will it only sort randomly following text-based relevance? Does anyone know how we can randomly sort after sorting by location?

Hi Curtis -

Great question. If I am understanding correctly, what you’ll want to do here is first sort by Entity Distance and then by Random Relevance in your sortBys. That way it will prioritize distance and then randomize. Does that make sense?

You can take a look at the sorting module for more information and syntax here: Entity Sorting Overview | Hitchhikers

Best,
Alyssa

Thanks, Alyssa!

One quick confirmation - would this mean that it always sorts by distance first, and not just when there is a query that references distance (i.e., “…near me”). For example, if a user searched “agents who offer xyz” - would agents with this offering always show up first, even over agents that are closer by location?

The client’s priority is that agents appear randomly when all else is equal. What’s confusing is that it seems like the experience preview is properly randomizing each time I refresh - but when I test it out in staging, it randomizes a single time, but then doesn’t upon refreshing (or reopening the staging link). Do you have any idea why this might be?

Hey Curtis,

By default, Answers will sort using 1) Relevance and 2) Distance. Once you customize sorting, your search configuration will no longer have that default Relevance sorting. When relevance is not included, any phrase or text match searches will effectively be ignored while ranking results. In that example query, without Relevance as the primary sorting rule, agents who don’t offer “xyz” may still show up before agents that do offer “xyz” because of proximity sorting being first, unless you utilize NLP filtering instead of text/phrase match on whatever field is being used for agent offerings.

In terms of testing the randomization and seeing different results in preview versus staging, this may be an issue related to browser cache across sessions. One way to get around this would be to load your staging link in a new Incognito window multiple times to test the randomization without worrying about cached data carrying over.

Best,
DJ

Thanks, DJ. When testing in an incognito window, the search results do refresh randomly (with configuration set to Random Relevance as it initially was). In a non-incognito window, I am still seeing the results come up in one set order each time - so it seems like browser cache is the only hold up here. That said, my understanding is that each user will see a unique sorting at first, which is what’s most important to the client. Thanks for the help!

1 Like