Sort_options applies only when query_string is not empty?

trying to figure out if this is a mistake or by design. if query_string is not set for the query, the SearchResults object is NOT sorted by the requested column. for example, here are some logs to show the problem:

Results are returned unsorted to 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 by 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 build my query for both cases ( options has limit , offset and sort_options ):

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

+8
python google-app-engine gae-search
source share
2 answers

It may be a dev_appserver error as suggested here , but of course you should test your application on your appspot

+1
source share

There may be a mistake in the way you create your request, as it is not displayed.

Maybe you do not have an index for a case that does not work.

-2
source share

All Articles