Index: oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java (revision bdaa017b49d578bbb5ff5222278f379e24923285) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java (date 1610174044690) @@ -18,24 +18,24 @@ */ package org.apache.jackrabbit.oak.query.ast; -import static org.apache.jackrabbit.oak.api.Type.STRING; -import static org.apache.jackrabbit.oak.api.Type.STRINGS; - -import java.text.ParseException; -import java.util.Collections; -import java.util.Set; - import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.PropertyValue; import org.apache.jackrabbit.oak.api.Tree; import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.commons.PathUtils; +import org.apache.jackrabbit.oak.plugins.memory.PropertyValues; +import org.apache.jackrabbit.oak.query.index.FilterImpl; +import org.apache.jackrabbit.oak.spi.query.QueryIndex.FulltextQueryIndex; import org.apache.jackrabbit.oak.spi.query.fulltext.FullTextContains; import org.apache.jackrabbit.oak.spi.query.fulltext.FullTextExpression; import org.apache.jackrabbit.oak.spi.query.fulltext.FullTextParser; -import org.apache.jackrabbit.oak.query.index.FilterImpl; -import org.apache.jackrabbit.oak.plugins.memory.PropertyValues; -import org.apache.jackrabbit.oak.spi.query.QueryIndex.FulltextQueryIndex; + +import java.text.ParseException; +import java.util.Collections; +import java.util.Set; + +import static org.apache.jackrabbit.oak.api.Type.STRING; +import static org.apache.jackrabbit.oak.api.Type.STRINGS; /** * A fulltext "contains(...)" condition. @@ -69,7 +69,7 @@ } else { this.propertyName = propertyName; } - + this.fullTextSearchExpression = fullTextSearchExpression; } @@ -143,11 +143,11 @@ throw new IllegalArgumentException("Invalid expression: " + fullTextSearchExpression, e); } } - + String getRawText(PropertyValue v) { return v.getValue(Type.STRING); } - + @Override public Set getSelectors() { return Collections.singleton(selector); @@ -155,9 +155,9 @@ /** * verify that a property exists in the node. {@code property IS NOT NULL} - * + * * @param propertyName the property to check - * @param selector the selector to work with + * @param selector the selector to work with * @return true if the property is there, false otherwise. */ boolean enforcePropertyExistence(String propertyName, SelectorImpl selector) { @@ -167,7 +167,7 @@ } return true; } - + @Override public boolean evaluate() { // disable evaluation if a fulltext index is used, @@ -225,7 +225,7 @@ } return getFullTextConstraint(selector).evaluate(buff.toString()); } - + @Override public boolean evaluateStop() { // if a fulltext index is used, then we are fine @@ -265,7 +265,9 @@ @Override public void restrict(FilterImpl f) { - f.restrictFulltextCondition(fullTextSearchExpression.currentValue().getValue(Type.STRING)); + if (selector.equals(f.getSelector())) { + f.restrictFulltextCondition(fullTextSearchExpression.currentValue().getValue(Type.STRING)); + } } @Override @@ -278,7 +280,7 @@ /** * restrict the provided property to the property to the provided filter achieving so * {@code property IS NOT NULL} - * + * * @param propertyName * @param f */