Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 晒黑solr通配符*:*_Python_Solr_Sunburnt - Fatal编程技术网

Python 晒黑solr通配符*:*

Python 晒黑solr通配符*:*,python,solr,sunburnt,Python,Solr,Sunburnt,我需要一种使用solr通配符的方法:在sunburnt 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

我需要一种使用solr通配符的方法:在sunburnt 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'])

像你这样的问题会很快赢得选票。努力弄清楚你想要什么。适当地编排你的问题,把问题分成段落,也许可以举例说明你想要达到的目标。否则,你的问题将永远得不到回答。谢谢Oz123,我刚刚重新格式化了它,希望它更好?你刚刚得到了一个答案,所以我猜它起作用了:-)我给了你一个向上的投票。继续问一些问得好的问题!Oz123,也谢谢你,答案是正确的。正是我在寻找的。非常感谢,不能投票,我想投票。