I run this query and it returns 15 products
+(+organizationId:6 +(mainGenre:dance alternateGenre:dance) +(state:pending state:published state:accepted)) +(alias:audioProduct)
So, it means that there are 15 products of organizationId = 6 AND (Main_Genre=Dance or Alternate_Genre=Dance). However, this query seen below doesn't return anything.
+(+organizationId:6 +(-mainGenre:pop -alternateGenre:pop) +(state:pending state:published state:accepted)) +(alias:audioProduct)
Now the query is like "organizationId = 6 AND Main_Genre!=Pop AND Alternate_Genre!=Pop". I think it should return at least 15 products. I mean it should return the products which were found for MainGenre:Dance.
Does anyone have any idea what I am doing wrong here?
In
(-mainGenre:pop -alternateGenre:pop)
, the OR operator is implied, i.e. it's equivalent toMain_Genre != pop OR Alternate_Genre != pop
while what you're after is
Main_Genre != pop AND Alternate_Genre != pop
You should try this instead (see the
&&
operator):