You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dietrich <di...@gmail.com> on 2011/04/28 17:19:46 UTC

Boost newer documents only if date is different from timestamp

I am trying to boost newer documents in Solr queries. The ms function
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
seems to be the right way to go, but I need to add an additional
condition:
I am using the last-Modified-Date from crawled web pages as the date
to consider, and that does not always provide a meaningful date.
Therefore I would like the function to only boost documents where the
date (not time) found in the last-Modified-Date is different from the
timestamp, eliminating results that just return the current date as
the last-Modified-Date. Suggestions are appreciated!

Re: Boost newer documents only if date is different from timestamp

Posted by Chris Hostetter <ho...@fucit.org>.
The "map" function lets you replace an arbitrary range of values with a 
new value, so you could "map" any value greater then the ms that today 
started on to any other point in history...

http://wiki.apache.org/solr/FunctionQuery#map

An easier approach would be probably be to apply some logic at index time: 
you can still index the the Last-Modified date you are getting, 
but if you believe that date is artificial, you can index an alternate 
date (possibly based on some rules you know about the site, or reuse the 
"first' last modified date you ever got for that URL, etc...) in a 
distinct field and use that value for date boosting.

: I am trying to boost newer documents in Solr queries. The ms function
: http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
: seems to be the right way to go, but I need to add an additional
: condition:
: I am using the last-Modified-Date from crawled web pages as the date
: to consider, and that does not always provide a meaningful date.
: Therefore I would like the function to only boost documents where the
: date (not time) found in the last-Modified-Date is different from the
: timestamp, eliminating results that just return the current date as
: the last-Modified-Date. Suggestions are appreciated!
: 

-Hoss