Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr: Query runtime faceting calculations on date fields and current date

Given the following schema fields:

<field indexed="true" stored="true" name="Status" type="int" />
<field indexed="true" stored="true" name="StatusDate1" type="tdate" />
<field indexed="true" stored="true" name="StatusDate2" type="tdate" />

Is it possible for solr to handle a calculation of Status, given the current daily date and the fields StatusDate1 and StatusDate2?

For example: A certain object contains (ignore sintax) StatusDate1: 1/9/2016, StatusDate2: 5/9/2016, knowing that today is the 9/9/2016 the expected output would be Status=2.

This Status is calculated based on the current date and the StatusDate fields of every object. I would like to facet the Status field.

Is function queries the way to go? Or do I need to handle this at index time? (A task indexing every day would seem dummy) What is the best way to tackle this issue?

Note: My solr version is 4.6.0

like image 281
antao Avatar asked Nov 08 '22 11:11

antao


1 Answers

Regardless of faceting, have you tried the stats component? stats=true&stats.field=Status... filtering by the date fields??

like image 200
Nuno Lourenço Avatar answered Nov 15 '22 10:11

Nuno Lourenço