gpt4 book ai didi

python - Sunburnt solr 通配符 * :*

转载 作者:太空宇宙 更新时间:2023-11-03 13:50:10 25 4
gpt4 key购买 nike

我需要一种在 sunburnt solr 中使用 solr 通配符 : 的方法,或者是否有另一种方法可以从索引中指定“所有文档”然后进行精炼。这是代码

....
si = sunburnt.SolrInterface(url=solr_url,http_connection=h)
search_terms = {SEARCH_TERMS_COMIN_FROM_A_FORM}

#!This is where I need help!
result = si.query(WILDCARD)#I need all the docs from the index

#then I can do this
if search_terms['province']:
result = result.query(province=search_terms['province'])
if search_terms['town']:
result = result.query(town=search_terms['town'])
.......#two other similar if statement blocks
#finally
results = result.execute()

最佳答案

当然:出于这个确切原因,您可以只使用一个空查询 - 这会起作用:

result = si.query()

if search_terms['province']:
result = result.query(province=search_terms['province'])
if search_terms['town']:
result = result.query(town=search_terms['town'])

关于python - Sunburnt solr 通配符 * :*,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10684870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com