Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I do a boolean OR in solr?

Tags:

php

solr

drupal

I am completely new at this...

I am using durpal with the apachesolr module.

I have the following filter:

(  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
like image 627
AllisonC Avatar asked Mar 01 '26 04:03

AllisonC


1 Answers

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.

like image 97
Umar Avatar answered Mar 03 '26 16:03

Umar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!