如何在solr中进行布尔或运算


How do I do a boolean OR in solr?

我在这方面完全是新手…

我正在使用durpal与apachesolr模块。

我有以下过滤器:

(  tid:19895 OR tid:19937 ) AND  type:poster"
This does not return any results, but if I have the following, it returns the results as expected
(  tid:19937 ) AND  type:poster"
EDIT: This is all in a filter. I need to have a list of tids that it could be along with having type be poster. So it has to be type:poster AND one of the following tids: 19895, 19937

although:

((tid:(19895 OR 19937)) AND type:poster) should work irrespective of defaultOperator being OR/AND

adding the clauses as separate filter is better, so add two filters as

tid:(19895 OR 19937)

type:poster

should filter out the results working as AND and also cache the results for this filter separately for improved query performance for new queries using this filter.

I think its important to note that SOLR isn't a database. Its a search engine and therefore isn't going to work like a database query you may be used to.

adding a + means the field is required

+tid:19895 would mean that TID field is required to equal exactly 19895

*是通配符,所以添加它意味着您的字段将包含该值,但不一定等于该值。

tid:19895* would mean TID field contains 19895

看起来问题是在同一个过滤器中定义字段两次??

试着删除第二个"tid:"

在我的测试中,我这样做:我的SOLR查询是:

+type:poster

和过滤器是:

tid:19895 OR 19937

这是另一个类似于你的stackoverflow问题,因为你显然有不同的语法比我使用。

如果默认的boolen子句是"OR",则给出如下查询
((tid:(19895 19937)) AND type:poster)这个工作正常,我测试了