Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Views integration
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2012 at 15:36 UTC
Updated:
7 Oct 2014 at 13:04 UTC
Jump to comment: Most recent
Comments
Comment #1
tancI've tried creating a data processor but I can't seem to get it to work on date fields. I thought that I might be able to create a processor that adds a boost score to the results based on date but after playing with the code it looks like data processors might not be able to do that. I can add a boost score on preprocess but that would get stored in the index which isn't useful as this needs to be dynamically adjusted. So still stumped.
Comment #2
tancA little more information about doing this directly on a solr search query: http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_o...
But I have no idea how to implement this using search_api.
Comment #3
tancBased on the notes in a great blog post I was able to write the following function which adds relevancy score to my results based on date (most recent get higher score):
This boosts the most recently posted items in the search results by 10 points scaling down to around 3 points at about a year and slowly reducing after that. As stated in that blog post, using Wolfram Alpha to plot the curve can help in tweaking your results. Mine is here.
I hope this helps someone else out in the same situation.
Comment #5
inky@inky3d.com commentedHi tanc
I'm trying to add this to a site and needing a few extra directions.
Did you place the function in your template.php, or in a separate module, as the original blog post suggests?
Is the "ds_publication_date" specific to each site and/or solr index?
I've tried changing it to just "publication_date" and it comes up with no search results.
Any guidance would be appreciated,
thanks
Comment #6
inky@inky3d.com commentedIf anyone else comes across this, I managed to get this to work with Search API 7.x-1.13 and Search API Solr 7.x-1.6
The changes I made to tancs original script in #3 were based on the hooks outlined in search_api_solr.api.php
To find the field name specific to your solr index, look in the solr files under yoursolrindex/data/index/ and open one of the .fnm files. I didn't have access to the Solr schema browser, so had to dig through the index to find it.