You _might_ (and I haven't tried this) be able to use sorting by funtion with min/max for a date range field, see: "Sort by Function" here: https://lucene.apache.org/solr/guide/6_6/function-queries.html.
On Mon, Dec 18, 2017 at 5:09 AM, Michael Kuhlmann <k...@solr.info> wrote: > Am 16.12.2017 um 19:39 schrieb Georgios Petasis: >> Even if the DateRangeField field can store a range of dates, doesn't >> Solr understand that I have used single timestamps? > > No. It could theoretically, but sorting just isn't implemented in > DateRangeField. > >> I have even stored the dates. >> My problem is that I need to use the query formating stated in the >> documentation: >> https://lucene.apache.org/solr/guide/7_1/working-with-dates.html#date-range-formatting >> >> For example, if "financialYear" is a date range, I can do >> q=financialYear:2014 and it will return everything that has a date >> within 2014. If the field is date point, will it work? > > Yes, just query with the plain old range syntax: > q=financialYear:[2014-01-01T00:00:00.000Z TO 2015-01-01T00:00:00.000Z} > > DateRangeField might be slightly faster for such queries, but that > doesn't really matter much. I only used normal date fields yet, usually > they're fast enough. > > As a rule of thunb, only use DateRangeField if you really need to index > date ranges. > > -Michael