I am doing tag search function, user could observe a lot of tags, I get it all in one tuple, and now I would like to find all text which include at least one tag from the list.
Symbolic: text__contains__in=('asd','dsa')
My only idea is do loop e.g.:
q = text.objects.all()
for t in tag_tuple:
q.filter(data__contains=t)
EDIT: Now I see it is bad idea doing loop that way... (It will filter text with all tags inside) Is there any works idea?
EDIT: for example:
input tuple of tags, ('car', 'cat', 'cinema')
output all messages what contains at least one word from that tuple, so My cat is in the car
, cat is not allowed in the cinema
, i will drive my car to the cinema
Thanks for help!