[google-appengine] Re: weird sorting error with inequality filters

2009-08-21 Thread Scott Ellis
This cookbook recipe explains the problem, in the context of date ranges:

http://www.google.com.au/url?sa=tsource=webct=rescd=4url=http%3A%2F%2Fappengine-cookbook.appspot.com%2Frecipe%2Fhow-to-query-by-date-rangeei=DnuOStn7EY__kAWv3s27Cgusg=AFQjCNGKYfrrm9dYm7L43cZw8hvwK9R2mQsig2=xuGt41_VuFei-jvrp1uVBw

I'm not sure if the comments are valid.

2009/8/21 iceanfire iceanf...@gmail.com


 I'm getting the following error:

 BadArgumentError: First ordering property must be the same as
 inequality filter property, if specified for this query; received
 distance, expected cost

 when i run the following code:

 search_query.filter(cost , min_price)
 search_query.filter(cost , max_price)
 search_query.order(distance)


 Did anyone know about this? Its not in the docs (atleast from what
 i've read)...please tell me there's a way around this weird
 restriction! I can't really think of a way to restructure my app cause
 the inequality filter is basically a necessity at this point  i'd
 love to be able to sort my results by something other than cost...

 


--~--~-~--~~~---~--~~
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-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: weird sorting error with inequality filters

2009-08-21 Thread Scott Ellis
Sorry, ignore me :)

2009/8/21 Scott Ellis sje...@gmail.com

 This cookbook recipe explains the problem, in the context of date ranges:


 http://www.google.com.au/url?sa=tsource=webct=rescd=4url=http%3A%2F%2Fappengine-cookbook.appspot.com%2Frecipe%2Fhow-to-query-by-date-rangeei=DnuOStn7EY__kAWv3s27Cgusg=AFQjCNGKYfrrm9dYm7L43cZw8hvwK9R2mQsig2=xuGt41_VuFei-jvrp1uVBw

 I'm not sure if the comments are valid.

 2009/8/21 iceanfire iceanf...@gmail.com


 I'm getting the following error:

 BadArgumentError: First ordering property must be the same as
 inequality filter property, if specified for this query; received
 distance, expected cost

 when i run the following code:

 search_query.filter(cost , min_price)
 search_query.filter(cost , max_price)
 search_query.order(distance)


 Did anyone know about this? Its not in the docs (atleast from what
 i've read)...please tell me there's a way around this weird
 restriction! I can't really think of a way to restructure my app cause
 the inequality filter is basically a necessity at this point  i'd
 love to be able to sort my results by something other than cost...

 



--~--~-~--~~~---~--~~
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-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: weird sorting error with inequality filters

2009-08-21 Thread Philippe

here : 
http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Restrictions_on_Queries
check :  Properties In Inequality Filters Must Be Sorted Before Other
Sort Orders 

I think that you should do
search_query.filter(cost , min_price)
search_query.filter(cost , max_price)
search_query.order(cost)
search_query.order(distance)

On Aug 21, 10:58 am, iceanfire iceanf...@gmail.com wrote:
 I'm getting the following error:

 BadArgumentError: First ordering property must be the same as
 inequality filter property, if specified for this query; received
 distance, expected cost

 when i run the following code:

 search_query.filter(cost , min_price)
 search_query.filter(cost , max_price)
 search_query.order(distance)

 Did anyone know about this? Its not in the docs (atleast from what
 i've read)...please tell me there's a way around this weird
 restriction! I can't really think of a way to restructure my app cause
 the inequality filter is basically a necessity at this point  i'd
 love to be able to sort my results by something other than cost...
--~--~-~--~~~---~--~~
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-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: weird sorting error with inequality filters

2009-08-21 Thread iceanfire

Hi philippe,

I did try the code you provided but that doesn't really work--all it
does is rank the results in the order of cost. Infact, the result that
is furthest away, ends up coming in first place, with the rest
randomly scattered.

Any other ideas?

-thanks

On Aug 21, 5:43 am, Philippe philippe.cr...@gmail.com wrote:
 here :http://code.google.com/appengine/docs/python/datastore/queriesandinde...
 check :  Properties In Inequality Filters Must Be Sorted Before Other
 Sort Orders 

 I think that you should do
 search_query.filter(cost , min_price)
 search_query.filter(cost , max_price)
 search_query.order(cost)
 search_query.order(distance)

 On Aug 21, 10:58 am, iceanfire iceanf...@gmail.com wrote:

  I'm getting the following error:

  BadArgumentError: First ordering property must be the same as
  inequality filter property, if specified for this query; received
  distance, expected cost

  when i run the following code:

  search_query.filter(cost , min_price)
  search_query.filter(cost , max_price)
  search_query.order(distance)

  Did anyone know about this? Its not in the docs (atleast from what
  i've read)...please tell me there's a way around this weird
  restriction! I can't really think of a way to restructure my app cause
  the inequality filter is basically a necessity at this point  i'd
  love to be able to sort my results by something other than cost...
--~--~-~--~~~---~--~~
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-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---