You have to use basic python code
results = Example.all().filter("tags =", tagSearch).fetch(100)
results.sort(key=lambda x: x.tags.index(tagSearch))
2010/7/14 Vivek Ramachandran <[email protected]>
>
> Hello AppEngine Gurus,
>
>
>
> I have model which looks like this:
>
> class Example (db.Model) :
>
> name = db.StringProperty()
> tags = db.StringListProperty()
>
> I first query for a tag to get the list of entities which have them:
>
> results = Example.all().filter("tags =", tagSearch).fetch(100)
>
> This gives me a list of entities containing the "tagSearch" in their "tags"
> list.
>
> Here is how a sample of the result entities would look like:
>
> entityA = [tagSearch, m, n, o, ....]
>
>
> entityB = [a, b, c, tagSearch, ... ]
>
>
> entityC = [a, tagSearch, a, ,a ,x ....... ....]
>
> I want to sort all the entities in the result set based on the position of
> the item tagSearch in them, in descending order.
>
> basically - entityA, entityC, entityB
>
> How do I do this? note I am running this on appengine ...
>
> also assumption given than tagSearch will occur only once in any list.
>
> Any help will be highly appreciated.
>
> Rgds,
>
> VR
>
> --
> 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.
--
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.