5

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

antao
  • 767
  • 1
  • 9
  • 24

1 Answers1

1

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

Nuno Lourenço
  • 136
  • 2
  • 5
  • Thanks for the comment Nuno! And long time no see by the way, faceting is really what I need to evaluate if solr can give me in this scenario. I can actually make the querying work with some 'tricks', but had no luck with faceting. – antao Aug 10 '16 at 23:04
  • Totally understand it! But regard that the stats component also works with facets! Not trying to put in that direction, just putting the option in front of you – Nuno Lourenço Aug 16 '16 at 16:19