Details
-
Bug
-
Resolution: Fixed
-
Medium
-
3.10.0beta1
-
None
Description
The policyLimitationFilterQuery() function builds a query without wrapping the filterQuery in parenthesis.
As you can see in this query:
( ( ( m_installation_id:ac25ab8bea5147b5498a555b2c191139 AND ( ( m_section_id:1 OR m_section_id:8 OR m_section_id:9 )) OR ( ( m_contentclass_id:29 OR m_contentclass_id:30 OR m_contentclass_id:31 OR m_contentclass_id:32 OR m_contentclass_id:33 OR m_contentclass_id:40 ) AND ( m_section_id:3 )) OR ( ( m_section_id:6 )) OR ( ( m_contentclass_id:4 OR m_contentclass_id:45 OR m_contentclass_id:47 OR m_contentclass_id:48 OR m_contentclass_id:49 ) AND ( m_section_id:2 )) ) OR m_anon_access:true ) AND ( m_language_code:nor-NO ) )
It does an AND on m_installation_id against the first statement, and then an OR against the others. This gives unexpected results.
After patch:
( ( ( m_installation_id:ac25ab8bea5147b5498a555b2c191139 AND ( ( ( m_section_id:1 OR m_section_id:8 OR m_section_id:9 )) OR ( ( m_contentclass_id:29 OR m_contentclass_id:30 OR m_contentclass_id:31 OR m_contentclass_id:32 OR m_contentclass_id:33 OR m_contentclass_id:40 ) AND ( m_section_id:3 )) OR ( ( m_section_id:6 )) OR ( ( m_contentclass_id:4 OR m_contentclass_id:45 OR m_contentclass_id:47 OR m_contentclass_id:48 OR m_contentclass_id:49 ) AND ( m_section_id:2 )) ) ) OR m_anon_access:true ) AND ( m_language_code:nor-NO ) )
Which gives the correct result as far as i can tell.
Steps to reproduce
Fix for r2422:
Line 763 of classes/ezfezpsolrquerybuilder.php should be:
$filterQuery = '( ' . implode( ' OR ', $filterQueryPolicies ) . ')';
Instead of
$filterQuery = implode( ' OR ', $filterQueryPolicies );