Is it possible to sort calendar search results by priority?
Brad Bautista 5 years ago in BLOX CMS • updated 5 years ago • 2
Publisher would like a handful of large, tentpole events to appear at the top of relevant calendar search results, the thought being that more popular events should be displayed above less popular events.
My initial thought on implementing this was to assign those events a higher priority within the calendar, then sort search results by priority.
I tested this by changing the Calendar URL field in the Featured Search block to read "/calendar/?s=priority" (sans quotes) but, running the search, found my high-priority test item third out of four results.
Is the result we're after possible this way? If so, what am I doing wrong?
Customer support service by UserEcho
The default calendar search applies a default start date/time of today.
Removing that parameter to only show results for "calendar/search/?l=25&f=html" would display the priority order you're seeking.
Otherwise, there are a few Calendar specific Utility Regions currently available where you could insert a custom block displaying these Featured Events. We're working on applying a new region "Above Search Results" that will display a block below the calendar search block & above the search results.
This would allow you to create a block consisting of only "Featured Events" that always displays before the search results.
Look for that addition in the next couple weeks!
Thanks for the help! And for the feature update.
Testing bears out what you say about limiting parameters to ?l=25&f=html on queries: The highest-priority (i.e., weighted) event shows up at the top of the search results, irrespective of its start date. That's exactly what we're after.
But I'm struggling to figure out what I need to modify to get calendar searches to run those limited parameters by default — i.e., is this something that can/must be changed on a per-block basis, or is it on the template level? It seems that irrespective of the value of the Calendar URL field in the Calendar | Calendar: Featured Search block I've been using to test, search results are still returned with &unrolled=1 and &d1=yyyy-mm-dd&d2=&fl=&s=start_time&sd=asc appended to the parameters.
I also discovered an interesting quirk here which you may be able to offer insight on: I dropped the block Footer | Site Search on the test calendar page I'm working off of to see what would happen if I ran searches from that (so there are now two search forms on that page, Site Search and Calendar: Featured Search). By default (i.e., upon checking settings after placing the block), the Search URL option was checked and its value set to /calendar/search in the Site Search block settings.
If I run searches on my test string (museum) from this block, I get "Your search did not yield any results." But if I then re-run the search using the search form on that search-results page, the results display as I'd like them to, with the weighted result on top — despite the query also containing a bunch of other parameters (?l=25&f=html&unrolled=1&q=museum&d1=2018-01-17&d2=&fl=&s=start_time&sd=desc). At least, for that one specific string. The results were not reproducible with other test strings that should have functioned the same.