我正在做标签搜索功能,用户可以观察到很多标签,我把它全部放在一个元组中,现在我想从列表中找到包含至少一个标签的所有文本。
象征性:text__contains__in=('asd','dsa')
我唯一的想法是循环,例如:
q = text.objects.all()
for t in tag_tuple:
q.filter(data__contains=t)
例如:输入标签的元组,('car', 'cat', 'cinema')
输出包含该元组中至少一个单词的所有消息,所以,,My cat is in the car
谢谢
帮助!cat is not allowed in the cinema
i will drive my car to the cinema