3

I have a Solr index and each document is the information of an Event. In my schema Schedule is a multivalued field of type date. I am wondering if it is possible to boost the documents with a schedule date (any of those dates in the multivalued field) in the future and closest to the current date? I am using Dismax query and SolrNet client api.

Reza
  • 353
  • 1
  • 2
  • 15

1 Answers1

5

You can user Solr FunctionQuery - recip.

Example function query:

recip(ms(NOW/HOUR,_datefield_),3.16e-11,1,1)

Also read relevancy FAQ: http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents

Matej
  • 7,517
  • 2
  • 36
  • 45
  • To start with, if you were implementing comparisons on a field; wouldnt you rather be storing it as several rows? – Jesvin Jose Feb 06 '12 at 07:41
  • 1
    If I want to store an Event with only One date, I have to do Field Collapsing or Grouping later which makes it more difficult to work with. On the other hand one event may have only one date and another one tens of dates. That is why the best way to have dates is to use multivalued field. – Reza Feb 06 '12 at 16:57