Closed (fixed)
Project:
Date
Version:
6.x-2.4
Component:
Date API
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Apr 2010 at 02:24 UTC
Updated:
26 Jun 2013 at 18:30 UTC
Hello,
This support request is more or less related to what the Date Module offers, but I thought it might be interesting to mention here.
By default in Drupal Core, there are two search ranking factors: Keywords Relevance, and Post Date.
I was wondering if anybody achieved to use the CCK Date field as a ranking factor instead of the Post date of a node. I know something similar to a search could be achieved through Views, but I was wondering specifically about the Core Search Module and how it could use a Date field.
Thanks,
Comments
Comment #2
arlinsandbulte commentedHi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.
Thanks.
Comment #3
coredumperror commentedI apologize for re-opening a long-closed ticket, but this page is the top result on google for "drupal date search ranking", so I figured that those who come searching for this solution in the future would appreciate an answer.
Here's how to implement
hook_ranking()to add a new ranking score which uses a Date field:Replace
DATE_FIELD_NAMEwith the machine name of the date field that you want to rank by. Once you clear your site's cache, "Date field" will appear in the Content Ranking section on theadmin/config/search/settingspage of your site.The algorithm implemented through the
scoreandargumentsvalues sorts results in descending date order. You could get ascending date order by adding1 -in front ofUNIX_TIMESTAMP.