cfpb / sheer

A tool for loading arbitrary content into Elasticsearch and serving that content on the web.
Creative Commons Zero v1.0 Universal
29 stars 23 forks source link

Removed default query sorting, added defaults to dateutil parse #56

Closed dpford closed 10 years ago

dpford commented 10 years ago

A default date sort is no longer inserted into queries without a sort specified, fixing #49. Sites will have to specify the desired sort (as they currently do with "sort": "date:desc" in the _queries/ files), otherwise the results will appear in seemingly random order.

Also, dateutil.parser.parse(date_string), when missing one or more date elements from the string, uses values from today's date by default to fill in the gaps. For example, parse('2014-06') is missing the day, so it uses the current day when it creates the datetime object. In this example, an error would be raised if it were to happen on the 31st because that day doesn't exist in June. Now it will pass in the first day of the current month as a default, which should fix it.

Scotchester commented 10 years ago

@rosskarchner please review