You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Marcel Reutegger (JIRA)" <ji...@apache.org> on 2010/09/28 10:27:32 UTC
[jira] Created: (JCR-2759) Collapse nested OR expressions
Collapse nested OR expressions
------------------------------
Key: JCR-2759
URL: https://issues.apache.org/jira/browse/JCR-2759
Project: Jackrabbit Content Repository
Issue Type: Improvement
Components: jackrabbit-core
Reporter: Marcel Reutegger
Priority: Minor
Executing a query with multiple OR expressions in a predicate leads to score values that depend on the order of the operands.
For example, the following query:
//*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending
will return a slightly different result compared to:
//*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending
Internally jackrabbit parses the predicate of the first query into a tree:
orExpr(orExpr(contains(prop1, 'foo'), contains(prop2, 'foo')), contains(prop3, 'foo'))
Lucene will calculate the score for the inner OR expression first and then for the outer, which is not equivalent with a nested expression that has property names in a different sequence.
The query should be translated internally into a single OR expression with three operands. That way, the score value is always the same, irrespective of the order of the operands.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2759) Collapse nested OR expressions
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-2759:
----------------------------------
Attachment: JCR-2759.patch
Proposed patch.
> Collapse nested OR expressions
> ------------------------------
>
> Key: JCR-2759
> URL: https://issues.apache.org/jira/browse/JCR-2759
> Project: Jackrabbit Content Repository
> Issue Type: Improvement
> Components: jackrabbit-core
> Reporter: Marcel Reutegger
> Priority: Minor
> Attachments: JCR-2759.patch
>
>
> Executing a query with multiple OR expressions in a predicate leads to score values that depend on the order of the operands.
> For example, the following query:
> //*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending
> will return a slightly different result compared to:
> //*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending
> Internally jackrabbit parses the predicate of the first query into a tree:
> orExpr(orExpr(contains(prop1, 'foo'), contains(prop2, 'foo')), contains(prop3, 'foo'))
> Lucene will calculate the score for the inner OR expression first and then for the outer, which is not equivalent with a nested expression that has property names in a different sequence.
> The query should be translated internally into a single OR expression with three operands. That way, the score value is always the same, irrespective of the order of the operands.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2759) Collapse nested OR expressions
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-2759:
----------------------------------
Status: Resolved (was: Patch Available)
Resolution: Fixed
Applied patch in revision: 1002596
> Collapse nested OR expressions
> ------------------------------
>
> Key: JCR-2759
> URL: https://issues.apache.org/jira/browse/JCR-2759
> Project: Jackrabbit Content Repository
> Issue Type: Improvement
> Components: jackrabbit-core
> Reporter: Marcel Reutegger
> Priority: Minor
> Fix For: 2.2.0
>
> Attachments: JCR-2759.patch
>
>
> Executing a query with multiple OR expressions in a predicate leads to score values that depend on the order of the operands.
> For example, the following query:
> //*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending
> will return a slightly different result compared to:
> //*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending
> Internally jackrabbit parses the predicate of the first query into a tree:
> orExpr(orExpr(contains(prop1, 'foo'), contains(prop2, 'foo')), contains(prop3, 'foo'))
> Lucene will calculate the score for the inner OR expression first and then for the outer, which is not equivalent with a nested expression that has property names in a different sequence.
> The query should be translated internally into a single OR expression with three operands. That way, the score value is always the same, irrespective of the order of the operands.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2759) Collapse nested OR expressions
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-2759:
----------------------------------
Status: Patch Available (was: Open)
> Collapse nested OR expressions
> ------------------------------
>
> Key: JCR-2759
> URL: https://issues.apache.org/jira/browse/JCR-2759
> Project: Jackrabbit Content Repository
> Issue Type: Improvement
> Components: jackrabbit-core
> Reporter: Marcel Reutegger
> Priority: Minor
> Attachments: JCR-2759.patch
>
>
> Executing a query with multiple OR expressions in a predicate leads to score values that depend on the order of the operands.
> For example, the following query:
> //*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending
> will return a slightly different result compared to:
> //*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending
> Internally jackrabbit parses the predicate of the first query into a tree:
> orExpr(orExpr(contains(prop1, 'foo'), contains(prop2, 'foo')), contains(prop3, 'foo'))
> Lucene will calculate the score for the inner OR expression first and then for the outer, which is not equivalent with a nested expression that has property names in a different sequence.
> The query should be translated internally into a single OR expression with three operands. That way, the score value is always the same, irrespective of the order of the operands.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2759) Collapse nested OR expressions
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-2759:
----------------------------------
Fix Version/s: 2.2.0
> Collapse nested OR expressions
> ------------------------------
>
> Key: JCR-2759
> URL: https://issues.apache.org/jira/browse/JCR-2759
> Project: Jackrabbit Content Repository
> Issue Type: Improvement
> Components: jackrabbit-core
> Reporter: Marcel Reutegger
> Priority: Minor
> Fix For: 2.2.0
>
> Attachments: JCR-2759.patch
>
>
> Executing a query with multiple OR expressions in a predicate leads to score values that depend on the order of the operands.
> For example, the following query:
> //*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending
> will return a slightly different result compared to:
> //*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending
> Internally jackrabbit parses the predicate of the first query into a tree:
> orExpr(orExpr(contains(prop1, 'foo'), contains(prop2, 'foo')), contains(prop3, 'foo'))
> Lucene will calculate the score for the inner OR expression first and then for the outer, which is not equivalent with a nested expression that has property names in a different sequence.
> The query should be translated internally into a single OR expression with three operands. That way, the score value is always the same, irrespective of the order of the operands.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.