简体   繁体   English

干草堆Django SearchQuerySet

[英]Haystack django SearchQuerySet

I'm using Haystack Django for search engine. 我正在使用Haystack Django作为搜索引擎。

SearchQuerySet().filter(**conds)

the conds may include : 所述conds可以包括:

conds['name'] = Exact(name)
conds['category'] = Exact(category)
conds['city_id'] = Exact(city_id)

but beside I also want to add list of sub_category as conditions, so is there any way to add something like 除此之外 ,我还想添加sub_category的列表作为条件,所以有什么办法可以添加类似

conds['sub_category'] = list(city_id)

OK, the question seem to not clearly, I meant I want to add the key sub_category into the dictionary conds that values are list. OK,问题似乎并不清楚,我的意思是我要重点sub_category添加到字典conds,价值观是列表。 So i found this way could answer the question above: 所以我发现这种方式可以回答上面的问题:

conds['sub_categary__in']  = sub_category_list

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM