Yasir Malik
Yasir Malik

Reputation: 51

SOLR 3.1 - Date Issues

We are using SOLR 3.1 and facing many problems with dates.

We are using database Sql Server 2005. So, when we imported data from database to collection, the first problem we faced is, 4 hours difference in the database and collection dates. For example, if database has date like 6/2/2011 10:00:00 PM it would be in the collection like this 2011-06-03T02:00:00Z. I am simply using database field to import. There is not date format or any other function involve in between.

How can we sort records by date? Right now, i am using it like this (*:*)&sort=resumeupdate+desc to fetch all the records and sort it by date. But it is not sorting properly.

Upvotes: 1

Views: 668

Answers (1)

hross
hross

Reputation: 3671

Solr always stores its dates in UTC time. You need to both import your dates by transforming them to UTC and then convert your timestamps into UTC when you sort/filter. The dates Solr will return to you will be in UTC time, so you will need to convert them to the time zone you are in. Please see this issue for more details.

Otherwise, if everything is in UTC format then it should sort properly.

Upvotes: 2

Related Questions