0

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?

DataNucleus
  • 15,497
  • 3
  • 32
  • 37
Tim
  • 61
  • 2

1 Answers1

0

Can't answer on the specifics of how GAE/J's plugin processes that but a marginally better query would be

tags.contains(theTag) && (theTag == tagValue1 || theTag == tagValue2 || theTag == tagValue3)

so "theTag" is a variable.

DataNucleus
  • 15,497
  • 3
  • 32
  • 37