简体   繁体   English

Solr查询在现场查找IN,IT或IS

[英]Solr query looking for IN, IT, or IS in field

When performing these queries (separately): 执行这些查询时(分别):

country:IN

-or- -要么-

country:IT

-or- -要么-

country:IS

... I get all items in the index returned. ...我得到索引中返回的所有项目。 I want to get only the items whose country field matches those params. 我只想获取其国家/地区字段与这些参数匹配的项目。 I've tried every combination of escaping with single/double quotes and single/double slashes. 我已经尝试了用单引号/双引号和单/双斜杠转义的每种组合。 When doing so, no items are returned at all. 这样做时,根本不会返回任何项目。

I've verified that items exist in the index for these params by dumping the whole index (with a loose query) and identifying them. 通过转储整个索引(使用松散查询)并标识它们,我已经验证了这些参数的索引中是否存在项目。 I'm on django-haystack in case that matters, but the issue is there for both the Django python shell and the Solr web admin interfaces. 万一重要,我在django-haystack上,但是Django python shell和Solr Web admin界面都存在问题。

Thanks for any help! 谢谢你的帮助!

Filter queries return a subset of documents that match them. 过滤查询返回与之匹配的文档子集。

fq=country:(IN OR IT OR IS)
fq=country:IN

Those are standard noise / stop words. 这些是标准的噪音/停用词。 You can either remove the terms from the stopwords file (stopwords_en.txt) and redindex your documents. 您可以从停用词文件(stopwords_en.txt)中删除术语,然后重新索引您的文档。 Or set the type to string and use fq like aitchnyu mentions above. 或将类型设置为string并使用fq,如上面提到的aitchnyu。

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

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