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 11:39:52 UTC
[jackrabbit-oak] branch trunk updated: Revert "Revert "OAK-9481:
avoid range queries on like conditions (#308)" (#322)" (#323)
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 1c97d87 Revert "Revert "OAK-9481: avoid range queries on like conditions (#308)" (#322)" (#323)
1c97d87 is described below
commit 1c97d875864767066de29949fb5b4882fe9fcd9b
Author: Fabrizio Fortino <fa...@gmail.com>
AuthorDate: Thu Jul 15 13:39:43 2021 +0200
Revert "Revert "OAK-9481: avoid range queries on like conditions (#308)" (#322)" (#323)
This reverts commit c2e53253
---
.../jackrabbit/oak/query/ast/ComparisonImpl.java | 10 ----------
.../plugins/index/lucene/LucenePropertyIndexTest.java | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 10 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 c8c0472..59568dc 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,17 +166,7 @@ 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 e6f39e3..8a045c2 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,6 +660,24 @@ 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();