I have set of search documents that have a DateField that I would like to sort by. The values in this field also contain the time. When I try to sort descending by this field, I'm getting the dates to sort correctly, but it seems as though the time is ignored ie:
{
"results": [
{
"photo_create_date": "2016-01-04T16:51:39.096000",
},
{
"photo_create_date": "2016-01-04T17:55:36.483000",
},
{
"photo_create_date": "2016-01-04T22:46:37.141000",
},
{
"photo_create_date": "2016-01-04T16:51:13.450000",
},
{
"photo_create_date": "2016-01-04T22:44:10.289000",
},
{
"photo_create_date": "2016-01-04T22:36:28.252000",
},
{
"photo_create_date": "2015-12-30T18:06:34.511000",
}
]
}
Any idea how to fix this or is this a limitation of the GAE search API?
Seeing as though, this seems to be a bug I had to roll my own solution. Here is what I used:
All you have to do is store this value as a NumberField and it works out pretty well. Some credit goes to this question in figuring out how to do this:
python - datetime with timezone to epoch
Here is the bug I filed with Google:
https://code.google.com/p/googleappengine/issues/detail?id=12650&thanks=12650&ts=1452021081
They rejected this as works as intended, so I created a feature request:
https://code.google.com/p/googleappengine/issues/detail?id=12651&thanks=12651&ts=1452038680