You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ca...@apache.org on 2016/11/30 18:03:33 UTC

svn commit: r1772100 [5/6] - in /jackrabbit/site/live/oak/docs/query: flags.html lucene-old.html lucene.html ootb-index-change.html ordered-index-migrate.html ordered-index.html property-index.html query-engine.html query.html solr.html

Modified: jackrabbit/site/live/oak/docs/query/query-engine.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/query/query-engine.html?rev=1772100&r1=1772099&r2=1772100&view=diff
==============================================================================
--- jackrabbit/site/live/oak/docs/query/query-engine.html (original)
+++ jackrabbit/site/live/oak/docs/query/query-engine.html Wed Nov 30 18:03:33 2016
@@ -1,835 +1,835 @@
-<!DOCTYPE html>
-<!--
- | Generated by Apache Maven Doxia at 2016-11-29
- | Rendered using Apache Maven Fluido Skin 1.3.0
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-  <head>
-    <meta charset="UTF-8" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <meta name="Date-Revision-yyyymmdd" content="20161129" />
-    <meta http-equiv="Content-Language" content="en" />
-    <title>Jackrabbit Oak - The Query Engine</title>
-    <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.min.css" />
-    <link rel="stylesheet" href="../css/site.css" />
-    <link rel="stylesheet" href="../css/print.css" media="print" />
-
-      
-    <script type="text/javascript" src="../js/apache-maven-fluido-1.3.0.min.js"></script>
-
-    
-            </head>
-        <body class="topBarEnabled">
-          
-    
-    
-            
-    
-    
-    <a href="http://github.com/apache/jackrabbit-oak">
-      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
-        src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
-        alt="Fork me on GitHub">
-    </a>
-  
-                
-                    
-                
-
-    <div id="topbar" class="navbar navbar-fixed-top ">
-      <div class="navbar-inner">
-                <div class="container-fluid">
-        <a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
-          <span class="icon-bar"></span>
-          <span class="icon-bar"></span>
-          <span class="icon-bar"></span>
-        </a>
-                
-                                                                                <a class="brand" href="../"  title="Oak logo">
-
-                                
-                                                                                                                    <img src="../oak_logo.png" alt="Oak logo" />
-                
-                </a>
-                    
-                                <ul class="nav">
-                          <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="../index.html"  title="Jackrabbit Oak">Jackrabbit Oak</a>
-</li>
-                  
-                      <li>      <a href="../license.html"  title="License">License</a>
-</li>
-                  
-                      <li>      <a href="../downloads.html"  title="Downloads">Downloads</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Concepts and Architecture <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="../architecture/overview.html"  title="Overview">Overview</a>
-</li>
-                  
-                      <li>      <a href="../architecture/nodestate.html"  title="The Node State Model">The Node State Model</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Main APIs <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="http://www.day.com/specs/jcr/2.0/index.html"  title="JCR API">JCR API</a>
-</li>
-                  
-                      <li>      <a href="../oak_api/overview.html"  title="Oak API">Oak API</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Features and Plugins <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="../features/atomic-counter.html"  title="Atomic Counter">Atomic Counter</a>
-</li>
-                  
-                      <li>      <a href="../plugins/blobstore.html"  title="Blob Storage">Blob Storage</a>
-</li>
-                  
-                      <li>      <a href="../clustering.html"  title="Clustering">Clustering</a>
-</li>
-                  
-                      <li>      <a href="../nodestore/documentmk.html"  title="DocumentNodeStore">DocumentNodeStore</a>
-</li>
-                  
-                      <li>      <a href="../nodestore/overview.html"  title="Node Storage">Node Storage</a>
-</li>
-                  
-                      <li>      <a href="../nodestore/persistent-cache.html"  title="Persistent Cache">Persistent Cache</a>
-</li>
-                  
-                      <li>      <a href="../query/query.html"  title="Query">Query</a>
-</li>
-                  
-                      <li>      <a href="../security/overview.html"  title="Security">Security</a>
-</li>
-                  
-                      <li>      <a href="../nodestore/segment/overview.html"  title="Segment Node Store">Segment Node Store</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Using Oak <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="../use_getting_started.html"  title="Getting Started">Getting Started</a>
-</li>
-                  
-                      <li>      <a href="../construct.html"  title="Repository Construction">Repository Construction</a>
-</li>
-                  
-                      <li>      <a href="../osgi_config.html"  title="Configuring Oak">Configuring Oak</a>
-</li>
-                  
-                      <li>      <a href="../command_line.html"  title="Command Line Tools">Command Line Tools</a>
-</li>
-                  
-                      <li>      <a href="../migration.html"  title="Migration">Migration</a>
-</li>
-                  
-                      <li>      <a href="../differences.html"  title="Differences to Jackrabbit 2">Differences to Jackrabbit 2</a>
-</li>
-                  
-                      <li>      <a href="../known_issues.html"  title="Known Issues">Known Issues</a>
-</li>
-                  
-                      <li>      <a href="../dos_and_donts.html"  title="Dos and Don'ts">Dos and Don'ts</a>
-</li>
-                  
-                      <li>      <a href="../coldstandby/coldstandby.html"  title="Cold Standby">Cold Standby</a>
-</li>
-                  
-                      <li>      <a href="../FAQ.html"  title="FAQ">FAQ</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Developing Oak <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="../dev_getting_started.html"  title="Getting Started">Getting Started</a>
-</li>
-                  
-                      <li>      <a href="../participating.html"  title="Participating">Participating</a>
-</li>
-                  
-                      <li>      <a href="../developing-with-git.html"  title="Developing with Git">Developing with Git</a>
-</li>
-                  
-                      <li>      <a href="../diagnostic-builds.html"  title="Cutting diagnostic builds">Cutting diagnostic builds</a>
-</li>
-                  
-                      <li>      <a href="../attribution.html"  title="Attribution">Attribution</a>
-</li>
-                  
-                      <li>      <a href="../release-schedule.html"  title="Release Schedule">Release Schedule</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Links <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="http://jackrabbit.apache.org/oak"  title="Apache Jackrabbit Oak">Apache Jackrabbit Oak</a>
-</li>
-                  
-                      <li>      <a href="http://jackrabbit.apache.org/"  title="Apache Jackrabbit">Apache Jackrabbit</a>
-</li>
-                          </ul>
-      </li>
-                  </ul>
-          
-          
-          
-                   
-                      </div>
-          
-        </div>
-      </div>
-    </div>
-    
-        <div class="container-fluid">
-          <div id="banner">
-        <div class="pull-left">
-                                <div id="bannerLeft">
-                <h2>Oak Documentation</h2>
-                </div>
-                      </div>
-        <div class="pull-right">  </div>
-        <div class="clear"><hr/></div>
-      </div>
-
-      <div id="breadcrumbs">
-        <ul class="breadcrumb">
-                
-                    
-                  <li id="publishDate">Last Published: 2016-11-29</li>
-                  <li class="divider">|</li> <li id="projectVersion">Version: 1.6-SNAPSHOT</li>
-                      
-                
-                    
-      
-                            </ul>
-      </div>
-
-            
-      <div class="row-fluid">
-        <div id="leftColumn" class="span3">
-          <div class="well sidebar-nav">
-                
-                    
-                <ul class="nav nav-list">
-                    <li class="nav-header">Overview</li>
-                                
-      <li>
-    
-                          <a href="../index.html" title="Jackrabbit Oak">
-          <i class="none"></i>
-        Jackrabbit Oak</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../license.html" title="License">
-          <i class="none"></i>
-        License</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../downloads.html" title="Downloads">
-          <i class="none"></i>
-        Downloads</a>
-            </li>
-                              <li class="nav-header">Concepts and Architecture</li>
-                                
-      <li>
-    
-                          <a href="../architecture/overview.html" title="Overview">
-          <i class="none"></i>
-        Overview</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../architecture/nodestate.html" title="The Node State Model">
-          <i class="none"></i>
-        The Node State Model</a>
-            </li>
-                              <li class="nav-header">Main APIs</li>
-                                
-      <li>
-    
-                          <a href="http://www.day.com/specs/jcr/2.0/index.html" class="externalLink" title="JCR API">
-          <i class="none"></i>
-        JCR API</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../oak_api/overview.html" title="Oak API">
-          <i class="none"></i>
-        Oak API</a>
-            </li>
-                              <li class="nav-header">Features and Plugins</li>
-                                
-      <li>
-    
-                          <a href="../features/atomic-counter.html" title="Atomic Counter">
-          <i class="none"></i>
-        Atomic Counter</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../plugins/blobstore.html" title="Blob Storage">
-          <i class="none"></i>
-        Blob Storage</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../clustering.html" title="Clustering">
-          <i class="none"></i>
-        Clustering</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../nodestore/documentmk.html" title="DocumentNodeStore">
-          <i class="none"></i>
-        DocumentNodeStore</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../nodestore/overview.html" title="Node Storage">
-          <i class="none"></i>
-        Node Storage</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../nodestore/persistent-cache.html" title="Persistent Cache">
-          <i class="none"></i>
-        Persistent Cache</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../query/query.html" title="Query">
-          <i class="none"></i>
-        Query</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../security/overview.html" title="Security">
-          <i class="none"></i>
-        Security</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../nodestore/segment/overview.html" title="Segment Node Store">
-          <i class="none"></i>
-        Segment Node Store</a>
-            </li>
-                              <li class="nav-header">Using Oak</li>
-                                
-      <li>
-    
-                          <a href="../use_getting_started.html" title="Getting Started">
-          <i class="none"></i>
-        Getting Started</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../construct.html" title="Repository Construction">
-          <i class="none"></i>
-        Repository Construction</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../osgi_config.html" title="Configuring Oak">
-          <i class="none"></i>
-        Configuring Oak</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../command_line.html" title="Command Line Tools">
-          <i class="none"></i>
-        Command Line Tools</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../migration.html" title="Migration">
-          <i class="none"></i>
-        Migration</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../differences.html" title="Differences to Jackrabbit 2">
-          <i class="none"></i>
-        Differences to Jackrabbit 2</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../known_issues.html" title="Known Issues">
-          <i class="none"></i>
-        Known Issues</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../dos_and_donts.html" title="Dos and Don'ts">
-          <i class="none"></i>
-        Dos and Don'ts</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../coldstandby/coldstandby.html" title="Cold Standby">
-          <i class="none"></i>
-        Cold Standby</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../FAQ.html" title="FAQ">
-          <i class="none"></i>
-        FAQ</a>
-            </li>
-                              <li class="nav-header">Developing Oak</li>
-                                
-      <li>
-    
-                          <a href="../dev_getting_started.html" title="Getting Started">
-          <i class="none"></i>
-        Getting Started</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../participating.html" title="Participating">
-          <i class="none"></i>
-        Participating</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../developing-with-git.html" title="Developing with Git">
-          <i class="none"></i>
-        Developing with Git</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../diagnostic-builds.html" title="Cutting diagnostic builds">
-          <i class="none"></i>
-        Cutting diagnostic builds</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../attribution.html" title="Attribution">
-          <i class="none"></i>
-        Attribution</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="../release-schedule.html" title="Release Schedule">
-          <i class="none"></i>
-        Release Schedule</a>
-            </li>
-                              <li class="nav-header">Links</li>
-                                
-      <li>
-    
-                          <a href="http://jackrabbit.apache.org/oak" class="externalLink" title="Apache Jackrabbit Oak">
-          <i class="none"></i>
-        Apache Jackrabbit Oak</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="http://jackrabbit.apache.org/" class="externalLink" title="Apache Jackrabbit">
-          <i class="none"></i>
-        Apache Jackrabbit</a>
-            </li>
-            </ul>
-                
-                    
-                
-          <hr class="divider" />
-
-           <div id="poweredBy">
-                   
-    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
-
-    
-    <div class="g-plusone" data-href="http://jackrabbit.apache.org/oak/docs/" data-size="tall" ></div>
-
-                   <div class="clear"></div>
-                            <div class="clear"></div>
-                            <div class="clear"></div>
-                             <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
-        <img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" />
-      </a>
-                  </div>
-          </div>
-        </div>
-        
-                
-        <div id="bodyColumn"  class="span9" >
-                                  
-            <!-- Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License. --><div class="section">
-<h2>The Query Engine<a name="The_Query_Engine"></a></h2>
-<p>Oak does not index as much content by default as does Jackrabbit 2. You need to create custom indexes when necessary, much like in traditional RDBMSs. If there is no index for a specific query, then the repository will be traversed. That is, the query will still work but probably be very slow.</p>
-<p>Query Indices are defined under the <tt>oak:index</tt> node.</p>
-<div class="section">
-<h3>Compatibility<a name="Compatibility"></a></h3>
-<div class="section">
-<h4>Result Size<a name="Result_Size"></a></h4>
-<p>For NodeIterator.getSize(), some versions of Jackrabbit 2.x returned the estimated (raw) Lucene result set size, including nodes that are not accessible. By default, Oak does not do this; it either returns the correct result size, or -1.</p>
-<p>Oak 1.2.x and newer supports a compatibility flag so that it works in the same way as Jackrabbit 2.x, by returning an estimate. See also OAK-2926. This is best configured as described in OAK-2977: When using Apache Sling, since Oak 1.3.x, add the following line to the file <tt>conf/sling.properties</tt>, and then restart the application:</p>
-
-<div class="source">
-<pre>oak.query.fastResultSize=true
-</pre></div>
-<p>Please note this only works with the Lucene <tt>compatVersion=2</tt> right now. Example code to show how this work (where <tt>test</tt> is a common word in the index):</p>
-
-<div class="source">
-<pre>String query = &quot;//element(*, cq:Page)[jcr:contains(., 'test')]&quot;;
-Query query = queryManager.createQuery(qs, &quot;xpath&quot;);
-QueryResult result = query.execute();
-long size = result.getRows().getSize();
-</pre></div></div>
-<div class="section">
-<h4>Quoting<a name="Quoting"></a></h4>
-<p>The query parser is now generally more strict about invalid syntax. The following query used to work in Jackrabbit 2.x, but not in Oak, because multiple way to quote the path are used at the same time:</p>
-
-<div class="source">
-<pre>SELECT * FROM [nt:base] AS s 
-WHERE ISDESCENDANTNODE(s, [&quot;/libs/sling/config&quot;])
-</pre></div>
-<p>Instead, the query now needs to be:</p>
-
-<div class="source">
-<pre>SELECT * FROM [nt:base] AS s 
-WHERE ISDESCENDANTNODE(s, [/libs/sling/config])
-</pre></div></div>
-<div class="section">
-<h4>Equality for Path Constraints<a name="Equality_for_Path_Constraints"></a></h4>
-<p>In Jackrabbit 2.x, the following condition was interpreted as a LIKE condition:</p>
-
-<div class="source">
-<pre>SELECT * FROM nt:base WHERE jcr:path = '/abc/%'
-</pre></div>
-<p>Therefore, the query behaves exactly the same as if LIKE was used. In Oak, this is no longer the case, and such queries search for an exact path match.</p></div></div>
-<div class="section">
-<h3>Slow Queries and Read Limits<a name="Slow_Queries_and_Read_Limits"></a></h3>
-<p>Slow queries are logged as follows:</p>
-
-<div class="source">
-<pre>*WARN* Traversed 10000 nodes with filter Filter(query=select ...)
-consider creating an index or changing the query
-</pre></div>
-<p>If this is the case, an index might need to be created, or the condition of the query might need to be changed to take advantage of an existing index.</p>
-<p>Queries that traverse many nodes, or that read many nodes in memory, can be cancelled. The limits can be set at runtime (also while a slow query is running) using JMX, domain &#x201c;org.apache.jackrabbit.oak&#x201d;, type &#x201c;QueryEngineSettings&#x201d;, attribute names &#x201c;LimitInMemory&#x201d; and &#x201c;LimitReads&#x201d;. These setting are not persisted, so in the next restart, the default values (unlimited) are used. As a workaround, these limits can be changed using the system properties &#x201c;oak.queryLimitInMemory&#x201d; and &#x201c;oak.queryLimitReads&#x201d;. Queries that exceed one of the limits are cancelled with an UnsupportedOperationException saying that &#x201c;The query read more than x nodes&#x2026; To avoid running out of memory, processing was stopped.&#x201d;</p></div>
-<div class="section">
-<h3>Full-Text Queries<a name="Full-Text_Queries"></a></h3>
-<p>The full-text syntax supported by Jackrabbit Oak is a superset of the JCR specification. The following syntax is supported within <tt>contains</tt> queries:</p>
-
-<div class="source">
-<pre>FullTextSearch ::= Or
-Or ::= And { ' OR ' And }* 
-And ::= Term { ' ' Term }*
-Term ::= ['-'] { SimpleTerm | PhraseTerm } [ '^' Boost ]
-SimpleTerm ::= Word
-PhraseTerm ::= '&quot;' Word { ' ' Word }* '&quot;'
-Boost ::= &lt;number&gt;
-</pre></div>
-<p>Please note that <tt>OR</tt> needs to be written in uppercase. Characters within words can be escaped using a backslash.</p>
-<p>Examples:</p>
-
-<div class="source">
-<pre>jcr:contains(., 'jelly sandwich^4')
-jcr:contains(@jcr:title, 'find this')
-</pre></div>
-<p>In the first example, the word &#x201c;sandwich&#x201d; has weight four times more than the word &#x201c;jelly.&#x201d; For details of boosting, see the Apache Lucene documentation about Score Boosting.</p>
-<p>For compatibility with Jackrabbit 2.x, single quoted phrase queries are currently supported. That means the query <tt>contains(., &quot;word ''hello world'' word&quot;)</tt> is supported. New applications should not rely on this feature.</p></div>
-<div class="section">
-<h3>Native Queries<a name="Native_Queries"></a></h3>
-<p>To take advantage of features that are available in full-text index implementations such as Apache Lucene and Apache Lucene Solr, so called <tt>native</tt> constraints are supported. Such constraints are passed directly to the full-text index. This is supported for both XPath and SQL-2. For XPath queries, the name of the function is <tt>rep:native</tt>, and for SQL-2, it is <tt>native</tt>. The first parameter is the index type (currently supported are <tt>solr</tt> and <tt>lucene</tt>). The second parameter is the native search query expression. For SQL-2, the selector name (if needed) is the first parameter, just before the language. Examples:</p>
-
-<div class="source">
-<pre>//*[rep:native('solr', 'name:(Hello OR World)')]
-
-select [jcr:path] from [nt:base] 
-where native('solr', 'name:(Hello OR World)')
-
-select [jcr:path] from [nt:base] as a 
-where native(a, 'solr', 'name:(Hello OR World)')
-</pre></div>
-<p>This also allows to use the Solr <a class="externalLink" href="http://wiki.apache.org/solr/MoreLikeThis">MoreLikeThis</a> feature. An example query is:</p>
-
-<div class="source">
-<pre>select [jcr:path] from [nt:base] 
-where native('solr', 'mlt?q=id:UTF8TEST&amp;mlt.fl=manu,cat&amp;mlt.mindf=1&amp;mlt.mintf=1')
-</pre></div>
-<p>If no full-text implementation is available, those queries will fail.</p></div>
-<div class="section">
-<h3>Similarity Queries<a name="Similarity_Queries"></a></h3>
-<p>Oak supports similarity queries when using the Lucene or Solr indexes. For example, the following query will return nodes that have similar content than the node /test/a:</p>
-
-<div class="source">
-<pre>//element(*, nt:base)[rep:similar(., '/test/a')]
-</pre></div>
-<p>Compared to Jackrabbit 2.x, support for rep:similar has the following limitations: Full-text aggregation is not currently supported.</p></div>
-<div class="section">
-<h3>Spellchecking<a name="Spellchecking"></a></h3>
-<p><tt>@since Oak 1.1.17, 1.0.13</tt></p>
-<p>Oak supports spellcheck queries when using the Lucene or Solr indexes. Unlike most queries, spellcheck queries won&#x2019;t return a JCR <tt>Node</tt> as the outcome of such queries will be text terms that come from content as written into JCR <tt>properties</tt>. For example, the following query will return spellchecks for the (wrongly spelled) term <tt>helo</tt>:</p>
-
-<div class="source">
-<pre>/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())
-</pre></div>
-<p>The result of such a query will be a JCR <tt>Row</tt> which will contain the corrected terms, as spellchecked by the used underlying index, in a special property named <tt>rep:spellcheck()</tt>.</p>
-<p>Clients wanting to obtain spellchecks could use the following JCR code:</p>
-<p><tt>@until Oak 1.3.10, 1.2.13</tt> spellchecks are returned flat.</p>
-
-<div class="source">
-<pre>QueryManager qm = ...;
-String xpath = &quot;/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())&quot;;
-QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
-RowIterator it = result.getRows();
-String spellchecks = &quot;&quot;;
-if (it.hasNext()) {
-    spellchecks = row.getValue(&quot;rep:spellcheck()&quot;).getString()        
-}
-</pre></div>
-<p>The <tt>spellchecks</tt> String would be have the following pattern <tt>\[[\w|\W]+(\,\s[\w|\W]+)*\]</tt>, e.g.:</p>
-
-<div class="source">
-<pre>[hello, hold]
-</pre></div>
-<p><tt>@since Oak 1.3.11, 1.2.14</tt> each spellcheck would be returned per row.</p>
-
-<div class="source">
-<pre>QueryManager qm = ...;
-String xpath = &quot;/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())&quot;;
-QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
-RowIterator it = result.getRows();
-List&lt;String&gt; spellchecks = new LinkedList&lt;String&gt;();
-while (it.hasNext()) {
-    spellchecks.add(row.getValue(&quot;rep:spellcheck()&quot;).getString());        
-}
-</pre></div>
-<p>If either Lucene or Solr were configured to provide the spellcheck feature, see <a href="lucene.html#Spellchecking">Enable spellchecking in Lucene</a> and <a href="solr.html#Spellchecking">Enable spellchecking in Solr</a></p>
-<p>Note that spellcheck terms come already filtered according to calling user privileges, so that users could see spellcheck corrections only coming from indexed content they are allowed to read.</p></div>
-<div class="section">
-<h3>Suggestions<a name="Suggestions"></a></h3>
-<p><tt>@since Oak 1.1.17, 1.0.15</tt></p>
-<p>Oak supports search suggestions when using the Lucene or Solr indexes. Unlike most queries, suggest queries won&#x2019;t return a JCR <tt>Node</tt> as the outcome of such queries will be text terms that come from content as written into JCR <tt>properties</tt>. For example, the following query will return search suggestions for the (e.g. user entered) term <tt>in</tt>:</p>
-
-<div class="source">
-<pre>/jcr:root[rep:suggest('in ')]/(rep:suggest())
-</pre></div>
-<p>The result of such a query will be a JCR <tt>Row</tt> which will contain the suggested terms, together with their score, as suggested and scored by the used underlying index, in a special property named <tt>rep:suggest()</tt>.</p>
-<p>Clients wanting to obtain suggestions could use the following JCR code:</p>
-<p><tt>@until Oak 1.3.10, 1.2.13</tt> suggestions are returned flat.</p>
-
-<div class="source">
-<pre>QueryManager qm = ...;
-String xpath = &quot;/jcr:root[rep:suggest('in ')]/(rep:suggest())&quot;;
-QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
-RowIterator it = result.getRows();
-String suggestions = &quot;&quot;;
-if (it.hasNext()) {
-    suggestions = row.getValue(&quot;rep:suggest()&quot;).getString()        
-}
-</pre></div>
-<p>The <tt>suggestions</tt> String would be have the following pattern <tt>\[\{(term\=)[\w|\W]+(\,weight\=)\d+\}(\,\{(term\=)[\w|\W]+(\,weight\=)\d+\})*\]</tt>, e.g.:</p>
-
-<div class="source">
-<pre>[{term=in 2015 a red fox is still a fox,weight=1.5}, {term=in 2015 my fox is red, like mike's fox and john's fox,weight=0.7}]
-</pre></div>
-<p><tt>@since Oak 1.3.11, 1.2.14</tt> each suggestion would be returned per row.</p>
-
-<div class="source">
-<pre>QueryManager qm = ...;
-String xpath = &quot;/jcr:root[rep:suggest('in ')]/(rep:suggest())&quot;;
-QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
-RowIterator it = result.getRows();
-List&lt;String&gt; suggestions = new LinkedList&lt;String&gt;();
-while (it.hasNext()) {
-    suggestions.add(row.getValue(&quot;rep:suggest()&quot;).getString());        
-}
-</pre></div>
-<p>If either Lucene or Solr were configured to provide the suggestions feature, see <a href="lucene.html#Suggestions">Enable suggestions in Lucene</a> and <a href="solr.html#Suggestions">Enable suggestions in Solr</a>. Note that suggested terms come already filtered according to calling user privileges, so that users could see suggested terms only coming from indexed content they are allowed to read.</p></div>
-<div class="section">
-<h3>Facets<a name="Facets"></a></h3>
-<p><tt>@since Oak 1.3.14</tt> Oak has support for <a class="externalLink" href="https://en.wikipedia.org/wiki/Faceted_search">facets</a>. Once enabled (see details for <a href="lucene.html#Facets">Lucene</a> and/or <a href="solr.html#Suggestions">Solr</a> indexes) facets can be retrieved on properties (backed by a proper field in Lucene / Solr) using the following snippet:</p>
-
-<div class="source">
-<pre>String sql2 = &quot;select [jcr:path], [rep:facet(tags)] from [nt:base] &quot; +
-                &quot;where contains([jcr:title], 'oak');
-Query q = qm.createQuery(sql2, Query.JCR_SQL2);
-QueryResult result = q.execute();
-FacetResult facetResult = new FacetResult(result);
-Set&lt;String&gt; dimensions = facetResult.getDimensions(); // { &quot;tags&quot; }
-List&lt;FacetResult.Facet&gt; facets = facetResult.getFacets(&quot;tags&quot;);
-for (FacetResult.Facet facet : facets) {
-    String label = facet.getLabel();
-    int count = facet.getCount();
-    ...
-}
-</pre></div>
-<p>Nodes/Rows can still be retrieved from within the QueryResult object the usual way.</p></div>
-<div class="section">
-<h3>XPath to SQL2 Transformation<a name="XPath_to_SQL2_Transformation"></a></h3>
-<p>To support the XPath query language, such queries are internally converted to SQL2. </p>
-<p>Every conversion is logged in <tt>debug</tt> level under the <tt>org.apache.jackrabbit.oak.query.QueryEngineImpl</tt> logger:</p>
-
-<div class="source">
-<pre>org.apache.jackrabbit.oak.query.QueryEngineImpl Parsing xpath statement: 
-    //element(*)[@sling:resourceType = 'slingevent:Lock')]
-org.apache.jackrabbit.oak.query.QueryEngineImpl XPath &gt; SQL2: 
-    select [jcr:path], [jcr:score], * from [nt:base] as a 
-    where [sling:resourceType] = 'slingevent:Lock' 
-    /* xpath: //element(*)[@sling:resourceType = 'slingevent:Lock' 
-    and @lock.created &lt; xs:dateTime('2013-09-02T15:44:05.920+02:00')] */
-</pre></div>
-<p><i>Each transformed SQL2 query contains the original XPath query as a comment.</i></p>
-<p>When converting from XPath to SQL-2, <tt>or</tt> conditions are automatically converted to <tt>union</tt> queries, so that indexes can be used for conditions of the form <tt>a = 'x' or b = 'y'</tt>.</p></div>
-<div class="section">
-<h3>Query Processing<a name="Query_Processing"></a></h3>
-<p>Internally, the query engine uses a cost based query optimizer that asks all the available query indexes for the estimated cost to process the query. It then uses the index with the lowest cost.</p>
-<p>By default, the following indexes are available:</p>
-
-<ul>
-  
-<li>A property index for each indexed property.</li>
-  
-<li>A full-text index which is based on Apache Lucene / Solr.</li>
-  
-<li>A node type index (which is based on an property index for the properties  jcr:primaryType and jcr:mixins).</li>
-  
-<li>A traversal index that iterates over a subtree.</li>
-</ul>
-<p>If no index can efficiently process the filter condition, the nodes in the repository are traversed at the given subtree.</p>
-<p>Usually, data is read from the index and repository while traversing over the query result. There are exceptions however, where all data is read in memory when the query is executed. The most common case is when using an <tt>order by</tt> clause and the index can not provide a sorted result. There are other cases where paths of the results read so far are kept in memory, in order to not return duplicate results. This is the case when using <tt>or</tt> conditions such that two indexes are used (internally a <tt>union</tt> query is executed).</p>
-<p>If you enable debug logging for the module <tt>org.apache.jackrabbit.oak.query</tt>, you may see this:</p>
-
-<div class="source">
-<pre>cost for nodeType is 1638354.0
-cost for property is 2.0
-cost for traverse is 3451100.0
-</pre></div>
-<p>This means the cost for the nodetype index <i>would</i> be about 1638354.0, the cost for the property index <i>would</i> be about 2, and the cost for traversal <i>would</i> be about 3451100.0. It doesn&#x2019;t say traversal is actually used, it just lists the expected costs. The query engine will then pick the index with the lowest expected cost, which is (in the case above) &#x201c;property&#x201d;.</p>
-<p>The expected cost for traversal is, with Oak 1.0.x, really just a guess looking at the length of the path. With Oak 1.2 and newer, the &#x201c;counter&#x201d; index is used (see mainly OAK-1907). There is an known issue with this, if you add and remove a lot of nodes in a loop, you could end up with a too-low cost, see OAK-4065.</p></div>
-<div class="section">
-<h3>The Node Type Index<a name="The_Node_Type_Index"></a></h3>
-<p>The <tt>NodeTypeIndex</tt> implements a <tt>QueryIndex</tt> using <tt>PropertyIndexLookup</tt>s on <tt>jcr:primaryType</tt> <tt>jcr:mixinTypes</tt> to evaluate a node type restriction on the filter. The cost for this index is the sum of the costs of the <tt>PropertyIndexLookup</tt> for queries on <tt>jcr:primaryType</tt> and <tt>jcr:mixinTypes</tt>.</p></div>
-<div class="section">
-<h3>Temporarily Disabling an Index<a name="Temporarily_Disabling_an_Index"></a></h3>
-<p>To temporarily disable an index (for example for testing), set the index type to <tt>disabled</tt>. Please note that while the index type is not set, the index is not updated, so if you enable it again, it might not be correct. This is specially important for synchronous indexes.</p></div>
-<div class="section">
-<h3>The Ordered Index (deprecated since 1.1.8)<a name="The_Ordered_Index_deprecated_since_1.1.8"></a></h3>
-<p>This index has been deprecated in favour of Lucene Property index. Please refer to <a href="lucene.html">Lucene Index documentation</a> for details.</p>
-<p>For help on migrating to a Lucece index please refer to: <a href="ordered-index-migrate.html">Migrate ordered index</a></p>
-<p>For historical information around the index please refer to: <a href="ordered-index.html">Ordered Index</a>.</p></div>
-<div class="section">
-<h3>Cost Calculation<a name="Cost_Calculation"></a></h3>
-<p>Each query index is expected to estimate the worst-case cost to query with the given filter. The returned value is between 1 (very fast; lookup of a unique node) and the estimated number of entries to traverse, if the cursor would be fully read, and if there could in theory be one network round-trip or disk read operation per node (this method may return a lower number if the data is known to be fully in memory).</p>
-<p>The returned value is supposed to be an estimate and doesn&#x2019;t have to be very accurate. Please note this method is called on each index whenever a query is run, so the method should be reasonably fast (not read any data itself, or at least not read too much data).</p>
-<p>If an index implementation can not query the data, it has to return <tt>Double.POSITIVE_INFINITY</tt>.</p></div>
-<div class="section">
-<h3>Index storage and manual inspection<a name="Index_storage_and_manual_inspection"></a></h3>
-<p>Sometimes there is a need to inspect the index content for debugging (or pure curiosity). The index content is generally stored as content under the index definition as hidden nodes (this doesn&#x2019;t apply to the solr index). In order to be able to browse down into an index content you need a low level repository tool that allows NodeStore level access. There are currently 2 options: the oak-console (command line tool, works will all existing NodeStore implementations) and the oak-explorer (gui based on java swing, works only on the TarMK), both available as run modes of the <a class="externalLink" href="https://github.com/apache/jackrabbit-oak/blob/trunk/oak-run/README.md">oak-run</a> module</p>
-<p>The structure of the index is specific to each implementation and is subject to change. What is worth mentioning is that all the <i>*PropertyIndex</i> flavors store the content as unstructured nodes (clear readable text), the <i>Lucene</i> index is stored as binaries, so one would need to export the entire Lucene directory to the local file system and browse it using a dedicated tool.</p></div>
-<div class="section">
-<h3>SQL2 Optimisation<a name="SQL2_Optimisation"></a></h3>
-
-<div class="source">
-<pre>@since 1.3.9 with -Doak.query.sql2optimisation
-</pre></div>
-<p>Enabled by default in 1.3.11 it will perform a round of optimisation on the <tt>Query</tt> object obtained after parsing a SQL2 statement. It will for example attempt a conversion of OR conditions into UNION <a class="externalLink" href="https://issues.apache.org/jira/browse/OAK-1617">OAK-1617</a>.</p>
-<p>To disable it provide <tt>-Doak.query.sql2optimisation=false</tt> at the start-up.</p></div>
-<div class="section">
-<h3>Additional XPath and SQL-2 Features<a name="Additional_XPath_and_SQL-2_Features"></a></h3>
-<p>The Oak implementation supports some features that are not part of the JCR specification:</p>
-
-<div class="source">
-<pre>@since 1.5.12
-</pre></div>
-<p>Union for XPath and SQL-2 queries. Examples:</p>
-
-<div class="source">
-<pre>/jcr:root/(content|lib)/*
-/jcr:root/content//*[@a] | /jcr:root/lib//*[@b]) order by @c
-select * from [nt:base] as a where issamenode(a, '/content') 
-union select * from [nt:base] as a where issamenode(a, '/lib')
-</pre></div>
-<p>XPath functions &#x201c;fn:string-length&#x201d; and &#x201c;fn:local-name&#x201d;.</p></div></div>
-                  </div>
-            </div>
-          </div>
-
-    <hr/>
-
-    <footer>
-            <div class="container-fluid">
-              <div class="row span12">Copyright &copy;                    2012-2016
-                        <a href="http://www.apache.org/">The Apache Software Foundation</a>.
-            All Rights Reserved.      
-                    
-      </div>
-
-        
-        
-          
-    
-    
-                
-    <div id="ohloh" class="pull-right">
-      <script type="text/javascript" src="http://www.ohloh.net/p/jackrabbit-oak/widgets/project_thin_badge.js"></script>
-    </div>
-        </div>
-    </footer>
-  </body>
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2016-11-30
+ | Rendered using Apache Maven Fluido Skin 1.3.0
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20161130" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Jackrabbit Oak - The Query Engine</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.3.0.min.js"></script>
+
+    
+            </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+    
+    <a href="http://github.com/apache/jackrabbit-oak">
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
+        src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top ">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                                                                <a class="brand" href="../"  title="Oak logo">
+
+                                
+                                                                                                                    <img src="../oak_logo.png" alt="Oak logo" />
+                
+                </a>
+                    
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../index.html"  title="Jackrabbit Oak">Jackrabbit Oak</a>
+</li>
+                  
+                      <li>      <a href="../license.html"  title="License">License</a>
+</li>
+                  
+                      <li>      <a href="../downloads.html"  title="Downloads">Downloads</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Concepts and Architecture <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../architecture/overview.html"  title="Overview">Overview</a>
+</li>
+                  
+                      <li>      <a href="../architecture/nodestate.html"  title="The Node State Model">The Node State Model</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Main APIs <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://www.day.com/specs/jcr/2.0/index.html"  title="JCR API">JCR API</a>
+</li>
+                  
+                      <li>      <a href="../oak_api/overview.html"  title="Oak API">Oak API</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Features and Plugins <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../features/atomic-counter.html"  title="Atomic Counter">Atomic Counter</a>
+</li>
+                  
+                      <li>      <a href="../plugins/blobstore.html"  title="Blob Storage">Blob Storage</a>
+</li>
+                  
+                      <li>      <a href="../clustering.html"  title="Clustering">Clustering</a>
+</li>
+                  
+                      <li>      <a href="../nodestore/documentmk.html"  title="DocumentNodeStore">DocumentNodeStore</a>
+</li>
+                  
+                      <li>      <a href="../nodestore/overview.html"  title="Node Storage">Node Storage</a>
+</li>
+                  
+                      <li>      <a href="../nodestore/persistent-cache.html"  title="Persistent Cache">Persistent Cache</a>
+</li>
+                  
+                      <li>      <a href="../query/query.html"  title="Query">Query</a>
+</li>
+                  
+                      <li>      <a href="../security/overview.html"  title="Security">Security</a>
+</li>
+                  
+                      <li>      <a href="../nodestore/segment/overview.html"  title="Segment Node Store">Segment Node Store</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Using Oak <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../use_getting_started.html"  title="Getting Started">Getting Started</a>
+</li>
+                  
+                      <li>      <a href="../construct.html"  title="Repository Construction">Repository Construction</a>
+</li>
+                  
+                      <li>      <a href="../osgi_config.html"  title="Configuring Oak">Configuring Oak</a>
+</li>
+                  
+                      <li>      <a href="../command_line.html"  title="Command Line Tools">Command Line Tools</a>
+</li>
+                  
+                      <li>      <a href="../migration.html"  title="Migration">Migration</a>
+</li>
+                  
+                      <li>      <a href="../differences.html"  title="Differences to Jackrabbit 2">Differences to Jackrabbit 2</a>
+</li>
+                  
+                      <li>      <a href="../known_issues.html"  title="Known Issues">Known Issues</a>
+</li>
+                  
+                      <li>      <a href="../dos_and_donts.html"  title="Dos and Don'ts">Dos and Don'ts</a>
+</li>
+                  
+                      <li>      <a href="../coldstandby/coldstandby.html"  title="Cold Standby">Cold Standby</a>
+</li>
+                  
+                      <li>      <a href="../FAQ.html"  title="FAQ">FAQ</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Developing Oak <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="../dev_getting_started.html"  title="Getting Started">Getting Started</a>
+</li>
+                  
+                      <li>      <a href="../participating.html"  title="Participating">Participating</a>
+</li>
+                  
+                      <li>      <a href="../developing-with-git.html"  title="Developing with Git">Developing with Git</a>
+</li>
+                  
+                      <li>      <a href="../diagnostic-builds.html"  title="Cutting diagnostic builds">Cutting diagnostic builds</a>
+</li>
+                  
+                      <li>      <a href="../attribution.html"  title="Attribution">Attribution</a>
+</li>
+                  
+                      <li>      <a href="../release-schedule.html"  title="Release Schedule">Release Schedule</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://jackrabbit.apache.org/oak"  title="Apache Jackrabbit Oak">Apache Jackrabbit Oak</a>
+</li>
+                  
+                      <li>      <a href="http://jackrabbit.apache.org/"  title="Apache Jackrabbit">Apache Jackrabbit</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                <div id="bannerLeft">
+                <h2>Oak Documentation</h2>
+                </div>
+                      </div>
+        <div class="pull-right">  </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                  <li id="publishDate">Last Published: 2016-11-30</li>
+                  <li class="divider">|</li> <li id="projectVersion">Version: 1.6-SNAPSHOT</li>
+                      
+                
+                    
+      
+                            </ul>
+      </div>
+
+            
+      <div class="row-fluid">
+        <div id="leftColumn" class="span3">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Overview</li>
+                                
+      <li>
+    
+                          <a href="../index.html" title="Jackrabbit Oak">
+          <i class="none"></i>
+        Jackrabbit Oak</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../license.html" title="License">
+          <i class="none"></i>
+        License</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../downloads.html" title="Downloads">
+          <i class="none"></i>
+        Downloads</a>
+            </li>
+                              <li class="nav-header">Concepts and Architecture</li>
+                                
+      <li>
+    
+                          <a href="../architecture/overview.html" title="Overview">
+          <i class="none"></i>
+        Overview</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../architecture/nodestate.html" title="The Node State Model">
+          <i class="none"></i>
+        The Node State Model</a>
+            </li>
+                              <li class="nav-header">Main APIs</li>
+                                
+      <li>
+    
+                          <a href="http://www.day.com/specs/jcr/2.0/index.html" class="externalLink" title="JCR API">
+          <i class="none"></i>
+        JCR API</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../oak_api/overview.html" title="Oak API">
+          <i class="none"></i>
+        Oak API</a>
+            </li>
+                              <li class="nav-header">Features and Plugins</li>
+                                
+      <li>
+    
+                          <a href="../features/atomic-counter.html" title="Atomic Counter">
+          <i class="none"></i>
+        Atomic Counter</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../plugins/blobstore.html" title="Blob Storage">
+          <i class="none"></i>
+        Blob Storage</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../clustering.html" title="Clustering">
+          <i class="none"></i>
+        Clustering</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../nodestore/documentmk.html" title="DocumentNodeStore">
+          <i class="none"></i>
+        DocumentNodeStore</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../nodestore/overview.html" title="Node Storage">
+          <i class="none"></i>
+        Node Storage</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../nodestore/persistent-cache.html" title="Persistent Cache">
+          <i class="none"></i>
+        Persistent Cache</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../query/query.html" title="Query">
+          <i class="none"></i>
+        Query</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../security/overview.html" title="Security">
+          <i class="none"></i>
+        Security</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../nodestore/segment/overview.html" title="Segment Node Store">
+          <i class="none"></i>
+        Segment Node Store</a>
+            </li>
+                              <li class="nav-header">Using Oak</li>
+                                
+      <li>
+    
+                          <a href="../use_getting_started.html" title="Getting Started">
+          <i class="none"></i>
+        Getting Started</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../construct.html" title="Repository Construction">
+          <i class="none"></i>
+        Repository Construction</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../osgi_config.html" title="Configuring Oak">
+          <i class="none"></i>
+        Configuring Oak</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../command_line.html" title="Command Line Tools">
+          <i class="none"></i>
+        Command Line Tools</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../migration.html" title="Migration">
+          <i class="none"></i>
+        Migration</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../differences.html" title="Differences to Jackrabbit 2">
+          <i class="none"></i>
+        Differences to Jackrabbit 2</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../known_issues.html" title="Known Issues">
+          <i class="none"></i>
+        Known Issues</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../dos_and_donts.html" title="Dos and Don'ts">
+          <i class="none"></i>
+        Dos and Don'ts</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../coldstandby/coldstandby.html" title="Cold Standby">
+          <i class="none"></i>
+        Cold Standby</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../FAQ.html" title="FAQ">
+          <i class="none"></i>
+        FAQ</a>
+            </li>
+                              <li class="nav-header">Developing Oak</li>
+                                
+      <li>
+    
+                          <a href="../dev_getting_started.html" title="Getting Started">
+          <i class="none"></i>
+        Getting Started</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../participating.html" title="Participating">
+          <i class="none"></i>
+        Participating</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../developing-with-git.html" title="Developing with Git">
+          <i class="none"></i>
+        Developing with Git</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../diagnostic-builds.html" title="Cutting diagnostic builds">
+          <i class="none"></i>
+        Cutting diagnostic builds</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../attribution.html" title="Attribution">
+          <i class="none"></i>
+        Attribution</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../release-schedule.html" title="Release Schedule">
+          <i class="none"></i>
+        Release Schedule</a>
+            </li>
+                              <li class="nav-header">Links</li>
+                                
+      <li>
+    
+                          <a href="http://jackrabbit.apache.org/oak" class="externalLink" title="Apache Jackrabbit Oak">
+          <i class="none"></i>
+        Apache Jackrabbit Oak</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://jackrabbit.apache.org/" class="externalLink" title="Apache Jackrabbit">
+          <i class="none"></i>
+        Apache Jackrabbit</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                   
+    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
+
+    
+    <div class="g-plusone" data-href="http://jackrabbit.apache.org/oak/docs/" data-size="tall" ></div>
+
+                   <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                             <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+        <img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" />
+      </a>
+                  </div>
+          </div>
+        </div>
+        
+                
+        <div id="bodyColumn"  class="span9" >
+                                  
+            <!-- Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License. --><div class="section">
+<h2>The Query Engine<a name="The_Query_Engine"></a></h2>
+<p>Oak does not index as much content by default as does Jackrabbit 2. You need to create custom indexes when necessary, much like in traditional RDBMSs. If there is no index for a specific query, then the repository will be traversed. That is, the query will still work but probably be very slow.</p>
+<p>Query Indices are defined under the <tt>oak:index</tt> node.</p>
+<div class="section">
+<h3>Compatibility<a name="Compatibility"></a></h3>
+<div class="section">
+<h4>Result Size<a name="Result_Size"></a></h4>
+<p>For NodeIterator.getSize(), some versions of Jackrabbit 2.x returned the estimated (raw) Lucene result set size, including nodes that are not accessible. By default, Oak does not do this; it either returns the correct result size, or -1.</p>
+<p>Oak 1.2.x and newer supports a compatibility flag so that it works in the same way as Jackrabbit 2.x, by returning an estimate. See also OAK-2926. This is best configured as described in OAK-2977: When using Apache Sling, since Oak 1.3.x, add the following line to the file <tt>conf/sling.properties</tt>, and then restart the application:</p>
+
+<div class="source">
+<pre>oak.query.fastResultSize=true
+</pre></div>
+<p>Please note this only works with the Lucene <tt>compatVersion=2</tt> right now. Example code to show how this work (where <tt>test</tt> is a common word in the index):</p>
+
+<div class="source">
+<pre>String query = &quot;//element(*, cq:Page)[jcr:contains(., 'test')]&quot;;
+Query query = queryManager.createQuery(qs, &quot;xpath&quot;);
+QueryResult result = query.execute();
+long size = result.getRows().getSize();
+</pre></div></div>
+<div class="section">
+<h4>Quoting<a name="Quoting"></a></h4>
+<p>The query parser is now generally more strict about invalid syntax. The following query used to work in Jackrabbit 2.x, but not in Oak, because multiple way to quote the path are used at the same time:</p>
+
+<div class="source">
+<pre>SELECT * FROM [nt:base] AS s 
+WHERE ISDESCENDANTNODE(s, [&quot;/libs/sling/config&quot;])
+</pre></div>
+<p>Instead, the query now needs to be:</p>
+
+<div class="source">
+<pre>SELECT * FROM [nt:base] AS s 
+WHERE ISDESCENDANTNODE(s, [/libs/sling/config])
+</pre></div></div>
+<div class="section">
+<h4>Equality for Path Constraints<a name="Equality_for_Path_Constraints"></a></h4>
+<p>In Jackrabbit 2.x, the following condition was interpreted as a LIKE condition:</p>
+
+<div class="source">
+<pre>SELECT * FROM nt:base WHERE jcr:path = '/abc/%'
+</pre></div>
+<p>Therefore, the query behaves exactly the same as if LIKE was used. In Oak, this is no longer the case, and such queries search for an exact path match.</p></div></div>
+<div class="section">
+<h3>Slow Queries and Read Limits<a name="Slow_Queries_and_Read_Limits"></a></h3>
+<p>Slow queries are logged as follows:</p>
+
+<div class="source">
+<pre>*WARN* Traversed 10000 nodes with filter Filter(query=select ...)
+consider creating an index or changing the query
+</pre></div>
+<p>If this is the case, an index might need to be created, or the condition of the query might need to be changed to take advantage of an existing index.</p>
+<p>Queries that traverse many nodes, or that read many nodes in memory, can be cancelled. The limits can be set at runtime (also while a slow query is running) using JMX, domain &#x201c;org.apache.jackrabbit.oak&#x201d;, type &#x201c;QueryEngineSettings&#x201d;, attribute names &#x201c;LimitInMemory&#x201d; and &#x201c;LimitReads&#x201d;. These setting are not persisted, so in the next restart, the default values (unlimited) are used. As a workaround, these limits can be changed using the system properties &#x201c;oak.queryLimitInMemory&#x201d; and &#x201c;oak.queryLimitReads&#x201d;. Queries that exceed one of the limits are cancelled with an UnsupportedOperationException saying that &#x201c;The query read more than x nodes&#x2026; To avoid running out of memory, processing was stopped.&#x201d;</p></div>
+<div class="section">
+<h3>Full-Text Queries<a name="Full-Text_Queries"></a></h3>
+<p>The full-text syntax supported by Jackrabbit Oak is a superset of the JCR specification. The following syntax is supported within <tt>contains</tt> queries:</p>
+
+<div class="source">
+<pre>FullTextSearch ::= Or
+Or ::= And { ' OR ' And }* 
+And ::= Term { ' ' Term }*
+Term ::= ['-'] { SimpleTerm | PhraseTerm } [ '^' Boost ]
+SimpleTerm ::= Word
+PhraseTerm ::= '&quot;' Word { ' ' Word }* '&quot;'
+Boost ::= &lt;number&gt;
+</pre></div>
+<p>Please note that <tt>OR</tt> needs to be written in uppercase. Characters within words can be escaped using a backslash.</p>
+<p>Examples:</p>
+
+<div class="source">
+<pre>jcr:contains(., 'jelly sandwich^4')
+jcr:contains(@jcr:title, 'find this')
+</pre></div>
+<p>In the first example, the word &#x201c;sandwich&#x201d; has weight four times more than the word &#x201c;jelly.&#x201d; For details of boosting, see the Apache Lucene documentation about Score Boosting.</p>
+<p>For compatibility with Jackrabbit 2.x, single quoted phrase queries are currently supported. That means the query <tt>contains(., &quot;word ''hello world'' word&quot;)</tt> is supported. New applications should not rely on this feature.</p></div>
+<div class="section">
+<h3>Native Queries<a name="Native_Queries"></a></h3>
+<p>To take advantage of features that are available in full-text index implementations such as Apache Lucene and Apache Lucene Solr, so called <tt>native</tt> constraints are supported. Such constraints are passed directly to the full-text index. This is supported for both XPath and SQL-2. For XPath queries, the name of the function is <tt>rep:native</tt>, and for SQL-2, it is <tt>native</tt>. The first parameter is the index type (currently supported are <tt>solr</tt> and <tt>lucene</tt>). The second parameter is the native search query expression. For SQL-2, the selector name (if needed) is the first parameter, just before the language. Examples:</p>
+
+<div class="source">
+<pre>//*[rep:native('solr', 'name:(Hello OR World)')]
+
+select [jcr:path] from [nt:base] 
+where native('solr', 'name:(Hello OR World)')
+
+select [jcr:path] from [nt:base] as a 
+where native(a, 'solr', 'name:(Hello OR World)')
+</pre></div>
+<p>This also allows to use the Solr <a class="externalLink" href="http://wiki.apache.org/solr/MoreLikeThis">MoreLikeThis</a> feature. An example query is:</p>
+
+<div class="source">
+<pre>select [jcr:path] from [nt:base] 
+where native('solr', 'mlt?q=id:UTF8TEST&amp;mlt.fl=manu,cat&amp;mlt.mindf=1&amp;mlt.mintf=1')
+</pre></div>
+<p>If no full-text implementation is available, those queries will fail.</p></div>
+<div class="section">
+<h3>Similarity Queries<a name="Similarity_Queries"></a></h3>
+<p>Oak supports similarity queries when using the Lucene or Solr indexes. For example, the following query will return nodes that have similar content than the node /test/a:</p>
+
+<div class="source">
+<pre>//element(*, nt:base)[rep:similar(., '/test/a')]
+</pre></div>
+<p>Compared to Jackrabbit 2.x, support for rep:similar has the following limitations: Full-text aggregation is not currently supported.</p></div>
+<div class="section">
+<h3>Spellchecking<a name="Spellchecking"></a></h3>
+<p><tt>@since Oak 1.1.17, 1.0.13</tt></p>
+<p>Oak supports spellcheck queries when using the Lucene or Solr indexes. Unlike most queries, spellcheck queries won&#x2019;t return a JCR <tt>Node</tt> as the outcome of such queries will be text terms that come from content as written into JCR <tt>properties</tt>. For example, the following query will return spellchecks for the (wrongly spelled) term <tt>helo</tt>:</p>
+
+<div class="source">
+<pre>/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())
+</pre></div>
+<p>The result of such a query will be a JCR <tt>Row</tt> which will contain the corrected terms, as spellchecked by the used underlying index, in a special property named <tt>rep:spellcheck()</tt>.</p>
+<p>Clients wanting to obtain spellchecks could use the following JCR code:</p>
+<p><tt>@until Oak 1.3.10, 1.2.13</tt> spellchecks are returned flat.</p>
+
+<div class="source">
+<pre>QueryManager qm = ...;
+String xpath = &quot;/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())&quot;;
+QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
+RowIterator it = result.getRows();
+String spellchecks = &quot;&quot;;
+if (it.hasNext()) {
+    spellchecks = row.getValue(&quot;rep:spellcheck()&quot;).getString()        
+}
+</pre></div>
+<p>The <tt>spellchecks</tt> String would be have the following pattern <tt>\[[\w|\W]+(\,\s[\w|\W]+)*\]</tt>, e.g.:</p>
+
+<div class="source">
+<pre>[hello, hold]
+</pre></div>
+<p><tt>@since Oak 1.3.11, 1.2.14</tt> each spellcheck would be returned per row.</p>
+
+<div class="source">
+<pre>QueryManager qm = ...;
+String xpath = &quot;/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())&quot;;
+QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
+RowIterator it = result.getRows();
+List&lt;String&gt; spellchecks = new LinkedList&lt;String&gt;();
+while (it.hasNext()) {
+    spellchecks.add(row.getValue(&quot;rep:spellcheck()&quot;).getString());        
+}
+</pre></div>
+<p>If either Lucene or Solr were configured to provide the spellcheck feature, see <a href="lucene.html#Spellchecking">Enable spellchecking in Lucene</a> and <a href="solr.html#Spellchecking">Enable spellchecking in Solr</a></p>
+<p>Note that spellcheck terms come already filtered according to calling user privileges, so that users could see spellcheck corrections only coming from indexed content they are allowed to read.</p></div>
+<div class="section">
+<h3>Suggestions<a name="Suggestions"></a></h3>
+<p><tt>@since Oak 1.1.17, 1.0.15</tt></p>
+<p>Oak supports search suggestions when using the Lucene or Solr indexes. Unlike most queries, suggest queries won&#x2019;t return a JCR <tt>Node</tt> as the outcome of such queries will be text terms that come from content as written into JCR <tt>properties</tt>. For example, the following query will return search suggestions for the (e.g. user entered) term <tt>in</tt>:</p>
+
+<div class="source">
+<pre>/jcr:root[rep:suggest('in ')]/(rep:suggest())
+</pre></div>
+<p>The result of such a query will be a JCR <tt>Row</tt> which will contain the suggested terms, together with their score, as suggested and scored by the used underlying index, in a special property named <tt>rep:suggest()</tt>.</p>
+<p>Clients wanting to obtain suggestions could use the following JCR code:</p>
+<p><tt>@until Oak 1.3.10, 1.2.13</tt> suggestions are returned flat.</p>
+
+<div class="source">
+<pre>QueryManager qm = ...;
+String xpath = &quot;/jcr:root[rep:suggest('in ')]/(rep:suggest())&quot;;
+QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
+RowIterator it = result.getRows();
+String suggestions = &quot;&quot;;
+if (it.hasNext()) {
+    suggestions = row.getValue(&quot;rep:suggest()&quot;).getString()        
+}
+</pre></div>
+<p>The <tt>suggestions</tt> String would be have the following pattern <tt>\[\{(term\=)[\w|\W]+(\,weight\=)\d+\}(\,\{(term\=)[\w|\W]+(\,weight\=)\d+\})*\]</tt>, e.g.:</p>
+
+<div class="source">
+<pre>[{term=in 2015 a red fox is still a fox,weight=1.5}, {term=in 2015 my fox is red, like mike's fox and john's fox,weight=0.7}]
+</pre></div>
+<p><tt>@since Oak 1.3.11, 1.2.14</tt> each suggestion would be returned per row.</p>
+
+<div class="source">
+<pre>QueryManager qm = ...;
+String xpath = &quot;/jcr:root[rep:suggest('in ')]/(rep:suggest())&quot;;
+QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
+RowIterator it = result.getRows();
+List&lt;String&gt; suggestions = new LinkedList&lt;String&gt;();
+while (it.hasNext()) {
+    suggestions.add(row.getValue(&quot;rep:suggest()&quot;).getString());        
+}
+</pre></div>
+<p>If either Lucene or Solr were configured to provide the suggestions feature, see <a href="lucene.html#Suggestions">Enable suggestions in Lucene</a> and <a href="solr.html#Suggestions">Enable suggestions in Solr</a>. Note that suggested terms come already filtered according to calling user privileges, so that users could see suggested terms only coming from indexed content they are allowed to read.</p></div>
+<div class="section">
+<h3>Facets<a name="Facets"></a></h3>
+<p><tt>@since Oak 1.3.14</tt> Oak has support for <a class="externalLink" href="https://en.wikipedia.org/wiki/Faceted_search">facets</a>. Once enabled (see details for <a href="lucene.html#Facets">Lucene</a> and/or <a href="solr.html#Suggestions">Solr</a> indexes) facets can be retrieved on properties (backed by a proper field in Lucene / Solr) using the following snippet:</p>
+
+<div class="source">
+<pre>String sql2 = &quot;select [jcr:path], [rep:facet(tags)] from [nt:base] &quot; +
+                &quot;where contains([jcr:title], 'oak');
+Query q = qm.createQuery(sql2, Query.JCR_SQL2);
+QueryResult result = q.execute();
+FacetResult facetResult = new FacetResult(result);
+Set&lt;String&gt; dimensions = facetResult.getDimensions(); // { &quot;tags&quot; }
+List&lt;FacetResult.Facet&gt; facets = facetResult.getFacets(&quot;tags&quot;);
+for (FacetResult.Facet facet : facets) {
+    String label = facet.getLabel();
+    int count = facet.getCount();
+    ...
+}
+</pre></div>
+<p>Nodes/Rows can still be retrieved from within the QueryResult object the usual way.</p></div>
+<div class="section">
+<h3>XPath to SQL2 Transformation<a name="XPath_to_SQL2_Transformation"></a></h3>
+<p>To support the XPath query language, such queries are internally converted to SQL2. </p>
+<p>Every conversion is logged in <tt>debug</tt> level under the <tt>org.apache.jackrabbit.oak.query.QueryEngineImpl</tt> logger:</p>
+
+<div class="source">
+<pre>org.apache.jackrabbit.oak.query.QueryEngineImpl Parsing xpath statement: 
+    //element(*)[@sling:resourceType = 'slingevent:Lock')]
+org.apache.jackrabbit.oak.query.QueryEngineImpl XPath &gt; SQL2: 
+    select [jcr:path], [jcr:score], * from [nt:base] as a 
+    where [sling:resourceType] = 'slingevent:Lock' 
+    /* xpath: //element(*)[@sling:resourceType = 'slingevent:Lock' 
+    and @lock.created &lt; xs:dateTime('2013-09-02T15:44:05.920+02:00')] */
+</pre></div>
+<p><i>Each transformed SQL2 query contains the original XPath query as a comment.</i></p>
+<p>When converting from XPath to SQL-2, <tt>or</tt> conditions are automatically converted to <tt>union</tt> queries, so that indexes can be used for conditions of the form <tt>a = 'x' or b = 'y'</tt>.</p></div>
+<div class="section">
+<h3>Query Processing<a name="Query_Processing"></a></h3>
+<p>Internally, the query engine uses a cost based query optimizer that asks all the available query indexes for the estimated cost to process the query. It then uses the index with the lowest cost.</p>
+<p>By default, the following indexes are available:</p>
+
+<ul>
+  
+<li>A property index for each indexed property.</li>
+  
+<li>A full-text index which is based on Apache Lucene / Solr.</li>
+  
+<li>A node type index (which is based on an property index for the properties  jcr:primaryType and jcr:mixins).</li>
+  
+<li>A traversal index that iterates over a subtree.</li>
+</ul>
+<p>If no index can efficiently process the filter condition, the nodes in the repository are traversed at the given subtree.</p>
+<p>Usually, data is read from the index and repository while traversing over the query result. There are exceptions however, where all data is read in memory when the query is executed. The most common case is when using an <tt>order by</tt> clause and the index can not provide a sorted result. There are other cases where paths of the results read so far are kept in memory, in order to not return duplicate results. This is the case when using <tt>or</tt> conditions such that two indexes are used (internally a <tt>union</tt> query is executed).</p>
+<p>If you enable debug logging for the module <tt>org.apache.jackrabbit.oak.query</tt>, you may see this:</p>
+
+<div class="source">
+<pre>cost for nodeType is 1638354.0
+cost for property is 2.0
+cost for traverse is 3451100.0
+</pre></div>
+<p>This means the cost for the nodetype index <i>would</i> be about 1638354.0, the cost for the property index <i>would</i> be about 2, and the cost for traversal <i>would</i> be about 3451100.0. It doesn&#x2019;t say traversal is actually used, it just lists the expected costs. The query engine will then pick the index with the lowest expected cost, which is (in the case above) &#x201c;property&#x201d;.</p>
+<p>The expected cost for traversal is, with Oak 1.0.x, really just a guess looking at the length of the path. With Oak 1.2 and newer, the &#x201c;counter&#x201d; index is used (see mainly OAK-1907). There is an known issue with this, if you add and remove a lot of nodes in a loop, you could end up with a too-low cost, see OAK-4065.</p></div>
+<div class="section">
+<h3>The Node Type Index<a name="The_Node_Type_Index"></a></h3>
+<p>The <tt>NodeTypeIndex</tt> implements a <tt>QueryIndex</tt> using <tt>PropertyIndexLookup</tt>s on <tt>jcr:primaryType</tt> <tt>jcr:mixinTypes</tt> to evaluate a node type restriction on the filter. The cost for this index is the sum of the costs of the <tt>PropertyIndexLookup</tt> for queries on <tt>jcr:primaryType</tt> and <tt>jcr:mixinTypes</tt>.</p></div>
+<div class="section">
+<h3>Temporarily Disabling an Index<a name="Temporarily_Disabling_an_Index"></a></h3>
+<p>To temporarily disable an index (for example for testing), set the index type to <tt>disabled</tt>. Please note that while the index type is not set, the index is not updated, so if you enable it again, it might not be correct. This is specially important for synchronous indexes.</p></div>
+<div class="section">
+<h3>The Ordered Index (deprecated since 1.1.8)<a name="The_Ordered_Index_deprecated_since_1.1.8"></a></h3>
+<p>This index has been deprecated in favour of Lucene Property index. Please refer to <a href="lucene.html">Lucene Index documentation</a> for details.</p>
+<p>For help on migrating to a Lucece index please refer to: <a href="ordered-index-migrate.html">Migrate ordered index</a></p>
+<p>For historical information around the index please refer to: <a href="ordered-index.html">Ordered Index</a>.</p></div>
+<div class="section">
+<h3>Cost Calculation<a name="Cost_Calculation"></a></h3>
+<p>Each query index is expected to estimate the worst-case cost to query with the given filter. The returned value is between 1 (very fast; lookup of a unique node) and the estimated number of entries to traverse, if the cursor would be fully read, and if there could in theory be one network round-trip or disk read operation per node (this method may return a lower number if the data is known to be fully in memory).</p>
+<p>The returned value is supposed to be an estimate and doesn&#x2019;t have to be very accurate. Please note this method is called on each index whenever a query is run, so the method should be reasonably fast (not read any data itself, or at least not read too much data).</p>
+<p>If an index implementation can not query the data, it has to return <tt>Double.POSITIVE_INFINITY</tt>.</p></div>
+<div class="section">
+<h3>Index storage and manual inspection<a name="Index_storage_and_manual_inspection"></a></h3>
+<p>Sometimes there is a need to inspect the index content for debugging (or pure curiosity). The index content is generally stored as content under the index definition as hidden nodes (this doesn&#x2019;t apply to the solr index). In order to be able to browse down into an index content you need a low level repository tool that allows NodeStore level access. There are currently 2 options: the oak-console (command line tool, works will all existing NodeStore implementations) and the oak-explorer (gui based on java swing, works only on the TarMK), both available as run modes of the <a class="externalLink" href="https://github.com/apache/jackrabbit-oak/blob/trunk/oak-run/README.md">oak-run</a> module</p>
+<p>The structure of the index is specific to each implementation and is subject to change. What is worth mentioning is that all the <i>*PropertyIndex</i> flavors store the content as unstructured nodes (clear readable text), the <i>Lucene</i> index is stored as binaries, so one would need to export the entire Lucene directory to the local file system and browse it using a dedicated tool.</p></div>
+<div class="section">
+<h3>SQL2 Optimisation<a name="SQL2_Optimisation"></a></h3>
+
+<div class="source">
+<pre>@since 1.3.9 with -Doak.query.sql2optimisation
+</pre></div>
+<p>Enabled by default in 1.3.11 it will perform a round of optimisation on the <tt>Query</tt> object obtained after parsing a SQL2 statement. It will for example attempt a conversion of OR conditions into UNION <a class="externalLink" href="https://issues.apache.org/jira/browse/OAK-1617">OAK-1617</a>.</p>
+<p>To disable it provide <tt>-Doak.query.sql2optimisation=false</tt> at the start-up.</p></div>
+<div class="section">
+<h3>Additional XPath and SQL-2 Features<a name="Additional_XPath_and_SQL-2_Features"></a></h3>
+<p>The Oak implementation supports some features that are not part of the JCR specification:</p>
+
+<div class="source">
+<pre>@since 1.5.12
+</pre></div>
+<p>Union for XPath and SQL-2 queries. Examples:</p>
+
+<div class="source">
+<pre>/jcr:root/(content|lib)/*
+/jcr:root/content//*[@a] | /jcr:root/lib//*[@b]) order by @c
+select * from [nt:base] as a where issamenode(a, '/content') 
+union select * from [nt:base] as a where issamenode(a, '/lib')
+</pre></div>
+<p>XPath functions &#x201c;fn:string-length&#x201d; and &#x201c;fn:local-name&#x201d;.</p></div></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+              <div class="row span12">Copyright &copy;                    2012-2016
+                        <a href="http://www.apache.org/">The Apache Software Foundation</a>.
+            All Rights Reserved.      
+                    
+      </div>
+
+        
+        
+          
+    
+    
+                
+    <div id="ohloh" class="pull-right">
+      <script type="text/javascript" src="http://www.ohloh.net/p/jackrabbit-oak/widgets/project_thin_badge.js"></script>
+    </div>
+        </div>
+    </footer>
+  </body>
 </html>
\ No newline at end of file

Modified: jackrabbit/site/live/oak/docs/query/query.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/query/query.html?rev=1772100&r1=1772099&r2=1772100&view=diff
==============================================================================
--- jackrabbit/site/live/oak/docs/query/query.html (original)
+++ jackrabbit/site/live/oak/docs/query/query.html Wed Nov 30 18:03:33 2016
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <!--
- | Generated by Apache Maven Doxia at 2016-11-29
+ | Generated by Apache Maven Doxia at 2016-11-30
  | Rendered using Apache Maven Fluido Skin 1.3.0
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <meta name="Date-Revision-yyyymmdd" content="20161129" />
+    <meta name="Date-Revision-yyyymmdd" content="20161130" />
     <meta http-equiv="Content-Language" content="en" />
     <title>Jackrabbit Oak - Oak Query</title>
     <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.min.css" />
@@ -216,7 +216,7 @@
         <ul class="breadcrumb">
                 
                     
-                  <li id="publishDate">Last Published: 2016-11-29</li>
+                  <li id="publishDate">Last Published: 2016-11-30</li>
                   <li class="divider">|</li> <li id="projectVersion">Version: 1.6-SNAPSHOT</li>