You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by fo...@apache.org on 2021/07/15 07:49:12 UTC
[jackrabbit-oak] branch trunk updated: Revert "OAK-9481: avoid
range queries on like conditions (#308)" (#322)
This is an automated email from the ASF dual-hosted git repository.
fortino pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new c2e5325 Revert "OAK-9481: avoid range queries on like conditions (#308)" (#322)
c2e5325 is described below
commit c2e53253bf0a20cae4a7ba983897a2b1ef014dab
Author: Fabrizio Fortino <fa...@gmail.com>
AuthorDate: Thu Jul 15 09:49:03 2021 +0200
Revert "OAK-9481: avoid range queries on like conditions (#308)" (#322)
This reverts commit 0e18ad35
---
.../jackrabbit/oak/query/ast/ComparisonImpl.java | 10 ++++++++++
.../plugins/index/lucene/LucenePropertyIndexTest.java | 18 ------------------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
index 59568dc..c8c0472 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
@@ -166,7 +166,17 @@ public class ComparisonImpl extends ConstraintImpl {
// but v may contain escaped wildcards, so we can't use it
PropertyValue pv = PropertyValues.newString(lowerBound);
operand1.restrict(f, Operator.EQUAL, pv);
+ } else if (operand1.supportsRangeConditions()) {
+ if (lowerBound != null) {
+ PropertyValue pv = PropertyValues.newString(lowerBound);
+ operand1.restrict(f, Operator.GREATER_OR_EQUAL, pv);
+ }
+ if (upperBound != null) {
+ PropertyValue pv = PropertyValues.newString(upperBound);
+ operand1.restrict(f, Operator.LESS_OR_EQUAL, pv);
+ }
} else {
+ // path conditions
operand1.restrict(f, operator, v);
}
} else {
diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
index 8a045c2..e6f39e3 100644
--- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
+++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
@@ -660,24 +660,6 @@ public class LucenePropertyIndexTest extends AbstractQueryTest {
}
@Test
- public void multiValuesLike() throws Exception{
- Tree idx = createIndex("test1", of("references"));
- root.commit();
-
- Tree test = root.getTree("/").addChild("test");
- test.addChild("a").setProperty("references", of("/some/content/AAA", "/some/content/BBB"), Type.STRINGS);
- test.addChild("b").setProperty("references", of("/some/content/AAA", "/some/content/CCC"), Type.STRINGS);
- root.commit();
-
- String q = "SELECT * FROM [nt:unstructured] as content WHERE references LIKE '/some/content/efjoiefjowfgj/%'";
- String explain = explain(q);
- String luceneQuery = explain.substring(0, explain.indexOf('\n'));
- assertEquals("[nt:unstructured] as [content] /* lucene:test1(/oak:index/test1) " +
- "references:/some/content/efjoiefjowfgj/*",
- luceneQuery);
- }
-
- @Test
public void redundantNotNullCheck() throws Exception{
Tree idx = createIndex("test1", of("tags"));
root.commit();