Στις 15/12/2017 20:05, ο Shawn Heisey έγραψε:
On 12/15/2017 2:53 AM, Georgios Petasis wrote:
I have a field of type "date_range" defined as:
<fieldType name="date_range" class="solr.DateRangeField"
multiValued="false" indexed="true" stored="true"/>
The problem is that sorting on this field does not work (despite the
fact that I put dates in there). Instead I get an error prompting to
perform sorting through a query.
Stating what Michael said in a different way: Entries in a
DateRangeField can be a date range, not just a single timestamp. How
would you decide what specific date to use in a sort? The start of the
range? The end of the range? The middle of the range? Any option that
the developers chose would be wrong for somebody, and it's not a
straightforward thing to make that choice configurable.
Michael suggested DatePointField. That should work, because this type
holds a single timestamp, not a range.
The reason that DateRangeField is deprecated is that it uses a legacy
Lucene class that will no longer be available in 8.0. Coming up with a
replacement is one of the many things that must be addressed before the
8.0 release.
Thanks,
Shawn
Even if the DateRangeField field can store a range of dates, doesn't
Solr understand that I have used single timestamps?
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?
George