1
MarkFull 2010-12-10 09:06:43 +08:00
这个是3个queries吧
|
2
timshi OP 你是说我必须做3个query然后再intersect the result myself?
|
3
MarkFull 2010-12-10 11:55:09 +08:00
intersect是下策,built-in的GQL我不是很熟悉
|
4
timshi OP 那你会怎么做? 我本来以为这个个index应该是这样的
person1, tagValue1 person1, tagValue2 person1, tagValue3 i.e an additional for each value in the multi-value property, and GAE should do a merge join to get me the result. But my index file looks like this <datastore-index kind="Person" ancestor="false" source="auto"> <property name="tags" direction="asc"/> <property name="tags" direction="asc"/> <property name="tags" direction="asc"/> <property name="tags" direction="asc"/> ..... |
5
MarkFull 2010-12-10 12:58:25 +08:00
no, each property should specify once for the same kind (Person).
There should be only one line of <property name="tags" direction="asc"/> This is the GQL format you can reference: SELECT [* | __key__] FROM <kind> [WHERE <condition> [AND <condition> ...]] [ORDER BY <property> [ASC | DESC] [, <property> [ASC | DESC] ...]] [LIMIT [<offset>,]<count>] [OFFSET <offset>] <condition> := <property> {< | <= | > | >= | = | != } <value> <condition> := <property> IN <list> <condition> := ANCESTOR IS <entity or key> |
6
MarkFull 2010-12-10 13:01:30 +08:00
Instead of using GQL, maybe you can use this:
filter(property_operator, value) Adds a property condition filter to the query. Only entities with properties that meet all of the conditions will be returned by the query. Arguments: property_operator A string containing the property name, and an optional comparison operator. The name and the operator must be separated by a space, as in: age > The following comparison operators are supported: < <= = >= > != IN If the operator is omitted from the string (the argument is just the property name), the filter uses the = operator. value The value to use in the comparison on the right-hand side of the expression. Its type should be the value data type for the property being compared. See Types and Property Classes. query.filter('height >', 42).filter('city = ', 'Seattle') query.filter('user = ', users.get_current_user()) from http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_filter |