[
https://issues.apache.org/jira/browse/OAK-622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13655872#comment-13655872
]
Thomas Mueller commented on OAK-622:
------------------------------------
Proposed patch for the FulltextQueryIndex:
{code}
#P oak-core
Index: src/main/java/org/apache/jackrabbit/oak/spi/query/QueryIndex.java
===================================================================
--- src/main/java/org/apache/jackrabbit/oak/spi/query/QueryIndex.java
(revision 1480286)
+++ src/main/java/org/apache/jackrabbit/oak/spi/query/QueryIndex.java
(working copy)
@@ -103,6 +103,16 @@
*/
String getIndexName();
+ /**
+ * A maker interface which means this index supports may support more than
+ * just the minimal fulltext query syntax. If this index is used, then the
+ * query engine does not verify the fulltext constraint(s) for the given
+ * selector.
+ */
+ public interface FulltextQueryIndex extends QueryIndex {
+ // marker interface
+ }
+
// /**
// * Return the possible index plans for the given filter and sort order.
// * Please note this method is supposed to run quickly. That means it
should
Index: src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
===================================================================
--- src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
(revision 1480286)
+++ src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
(working copy)
@@ -32,6 +32,7 @@
import org.apache.jackrabbit.oak.query.ast.ComparisonImpl.LikePattern;
import org.apache.jackrabbit.oak.query.index.FilterImpl;
import org.apache.jackrabbit.oak.spi.query.PropertyValues;
+import org.apache.jackrabbit.oak.spi.query.QueryIndex.FulltextQueryIndex;
/**
* A fulltext "contains(...)" condition.
@@ -100,6 +101,10 @@
@Override
public boolean evaluate() {
+ if (selector.index instanceof FulltextQueryIndex) {
+ return true;
+ }
+
StringBuilder buff = new StringBuilder();
if (relativePath == null && propertyName != null) {
PropertyValue p = selector.currentProperty(propertyName);
{code}
> Improve QueryIndex interface
> ----------------------------
>
> Key: OAK-622
> URL: https://issues.apache.org/jira/browse/OAK-622
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: query
> Reporter: Thomas Mueller
> Assignee: Thomas Mueller
> Priority: Minor
>
> The current QueryIndex interface is quite simple, but doesn't address some of
> the required features and more advanced optimizations that are possible:
> - For fulltext queries, it doesn't address the case where the index
> implementation has a different understanding of the fulltext condition than
> what is described in the JCR spec (the basic features).
> - For queries with "order by" it would be good to know if the index supports
> returning the data in sorted order, and if yes, how much slower that would be
> (if it is slower). So a index might have multiple strategies with different
> costs.
> - It's quite easy to misunderstand what getCost is supposed to do exactly.
> The new API should have a clearer solution here.
> - Even if the query doesn't have "order by", the index might return the data
> in a sorted way, which might help improving query performance (using a merge
> join)
> - The cost is currently a single value, it might be better to estimate the
> number of nodes, the cost to run a query, and the cost per node. That way we
> could optimize to quickly return the first few nodes (versus optimize for
> thoughput).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira