[ 
https://issues.apache.org/jira/browse/OAK-1982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14072969#comment-14072969
 ] 

Davide Giannella commented on OAK-1982:
---------------------------------------

[~tmueller]
bq. I believe you are working on a new ordered index implementation, could you 
ensure to do the same there please?

Pencilled it. I'll make sure of it.

Anyhow I was reviewing the patch. The non-processing has been applied
at the very top of the plans creation. In case of ordered index it
could play in case of the ORDER BY clause is the on an indexed
property. I would let the query engine then apply the filters.

I would go then for something like this

{noformat}
diff --git 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndex.java
 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndex.java
index a0aaaaa..aff0473 100644
--- 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndex.java
+++ 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndex.java
@@ -87,15 +87,6 @@ public class OrderedPropertyIndex implements QueryIndex, 
AdvancedQueryIndex {
             LOG.debug("getPlans() - rootState: {} - ", root);
         }
         List<IndexPlan> plans = new ArrayList<IndexPlan>();
-        if (filter.getFullTextConstraint() != null) {
-            // not an appropriate index for full-text search
-            return plans;
-        }
-        if (filter.containsNativeConstraint()) {
-            // not an appropriate index for native search
-            return plans;
-        }
-
         OrderedPropertyIndexLookup lookup = getLookup(root);
         Collection<PropertyRestriction> restrictions = 
filter.getPropertyRestrictions();
 
@@ -122,6 +113,7 @@ public class OrderedPropertyIndex implements QueryIndex, 
AdvancedQueryIndex {
         }
 
         // then we add plans for each restriction that could apply to us
+        if (filter.getFullTextConstraint() == null && 
!filter.containsNativeConstraint()) {
             for (Filter.PropertyRestriction pr : restrictions) {
                 String propertyName = PathUtils.getName(pr.propertyName);
                 if (lookup.isIndexed(propertyName, "/", filter)) {
@@ -163,6 +155,7 @@ public class OrderedPropertyIndex implements QueryIndex, 
AdvancedQueryIndex {
                     }
                 }
             }
+        }
 
         return plans;
     }
{noformat}

WDYT?



> Ordered index must ignore full-text queries
> -------------------------------------------
>
>                 Key: OAK-1982
>                 URL: https://issues.apache.org/jira/browse/OAK-1982
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0, 1.0.1, 1.0.2
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 1.1, 1.0.3
>
>
> Currently, the ordered index does not check for full-text constraints (like 
> the property index), and may returns a low cost for such cases.
> Only full-text indexes (Lucene, Solr) know how to process full-text 
> conditions. Only those indexes are supposed to return a low cost for such 
> queries.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to