On 12 September 2012 23:57, Jason <[email protected]> wrote:

> In order to do it in one query, you could add a field that is used
> specifically for sorting.  If the value of the normal field is positive,
> the sort field would be the same as the normal field.  If the value of the
> normal field is negative or zero, the sort field could be something like:
>  99999999 - normal field.  This would work as long as there's a known upper
> limit of the value of the normal positive field.


Yes, that approach seems reasonable to me too if you want to do it in one
query. [The sort expressions can currently draw on operators like max(),
min(), *, +, /, and - ; if you can't build an expression that generates the
value you want, then precomputing a sort field can be a good tactic].

However, unifying the two lists of results at the application level does
not seem problematic, since it sounds like you essentially just need to
concatenate them.

>
>
> On Wednesday, September 12, 2012 3:05:35 AM UTC-5, Jordi P.S. wrote:
>
>> I need all the elements: the ones that ranking > 0 and the ones that
>> ranking <= 0.
>>
>> As you say I could do 2 searchs the first with a query filter > 0 and the
>> other with the query filter <= 0 and unify them in the application logic.
>>
>> This would be a solution but, do you think there is a solution with only
>> 1 search ?
>>
>>
>> On Wed, Sep 12, 2012 at 9:47 AM, Amy Unruh <[email protected]> wrote:
>>
>>>  hi,
>>>
>>> How about adding a query filter on that field?  E.g., say this numeric
>>> field is called 'ranking'.  Your query could include:
>>>  ranking > 0
>>> along with any other search terms. E.g. if you also want to look for the
>>> word 'books', your query would look like:
>>>  books ranking > 0
>>>
>>> Then, define the sort expression to order on that field in ascending
>>> order.
>>>
>>> On 12 September 2012 02:54, Jordi P.S. <[email protected]> wrote:
>>>
>>>> Hello,
>>>>
>>>> I have a question concerning the SortExpression:
>>>> I'd like to sort a list of documents in Ascending order. I'd like to
>>>> avoid the 0 or negative values, which I'd put them at the end of the list.
>>>> Is there a way to do it with a sort expression?
>>>>
>>>> Example list:  1 0 4 5 2
>>>> Sorted list: 1 2 4 5 0
>>>>
>>>> Any idea?
>>>>
>>>> I'm thinking in something like: sortexpression="MAX_DOUBLE+**
>>>> field_name"
>>>>
>>>> Jordi.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google App Engine" group.
>>>> To view this discussion on the web visit https://groups.google.com/d/**
>>>> msg/google-appengine/-/**AlCFVki-VKsJ<https://groups.google.com/d/msg/google-appengine/-/AlCFVki-VKsJ>
>>>> .
>>>> To post to this group, send email to google-a...@googlegroups.**com.
>>>> To unsubscribe from this group, send email to google-appengi...@**
>>>> googlegroups.com.
>>>>
>>>> For more options, visit this group at http://groups.google.com/**
>>>> group/google-appengine?hl=en<http://groups.google.com/group/google-appengine?hl=en>
>>>> .
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google App Engine" group.
>>> To post to this group, send email to google-a...@googlegroups.**com.
>>> To unsubscribe from this group, send email to google-appengi...@**
>>> googlegroups.com.
>>>
>>> For more options, visit this group at http://groups.google.com/**
>>> group/google-appengine?hl=en<http://groups.google.com/group/google-appengine?hl=en>
>>> .
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/_ZMYPzrhEvAJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to