Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sort_options only applied when query_string is not empty?

trying to figure out whether this is a bug or by design. when no query_string is specified for a query, the SearchResults object is NOT sorted by the requested column. for example, here is some logging to show the problem:

Results are returned unsorted on return index.search(query):

query_string = ''

sort_options string: search.SortOptions(expressions=[search.SortExpression(expression=u'firstname', direction='ASCENDING', default_value=u'')], limit=36)

Results are returned sorted on return index.search(query):

query_string = 'test'

sort_options string: search.SortOptions(expressions=[search.SortExpression(expression=u'firstname', direction='ASCENDING', default_value=u'')], limit=36)

This is how I'm constructing my query for both cases (options has limit, offset and sort_options parameters):

query = search.Query(query_string=query_string, options=options)

like image 418
HorseloverFat Avatar asked Dec 19 '12 13:12

HorseloverFat


1 Answers

This may be a bug of the dev_appserver, as suggested here but to be sure, you should test your application on your appspot

like image 173
Samuele Mattiuzzo Avatar answered Oct 16 '22 13:10

Samuele Mattiuzzo