I have the following class (in JDO)

Class Person{
 @Persistent private List tags = ArrayList()
}

I want to let the user query a person based on his/her tag, so I had
my query filter like this:

tags.contains(tagValue1)

and if the user want to search for multiple tags, I would just add to
the filter so if the user is searching for 3 tags, then the query
would be

tags.contains(tagValue1) && tags.contains(tagValue2) &&
tags.contains(tagValue3)

I think this approach is wrong, because the datastore then needs to
have an index that have the tags property three times... and if the
user search for more than 3 tags at a time then it will be broken.

What's the proper way to do this? Do you guys have any suggestions?


In addition, I thought the index should like this

person1, tagValue1
person1, tagValue2
person1, tagValue3

i.e an additional row 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"/>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en.

Reply via email to