You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2014/05/07 22:40:06 UTC

svn commit: r1593133 - /jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md

Author: mduerig
Date: Wed May  7 20:40:06 2014
New Revision: 1593133

URL: http://svn.apache.org/r1593133
Log:
OAK-1797: Missing documentation around Ordered Index
Credits to Davide Giannella for the patch

Modified:
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md

Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md?rev=1593133&r1=1593132&r2=1593133&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md Wed May  7 20:40:06 2014
@@ -189,6 +189,50 @@ or to simplify you can use one of the ex
       IndexUtils.createIndexDefinition(index, "myProp", true, false, ImmutableList.of("myProp"), null);
     }
 
+### The Ordered Index
+
+Extension of the Property index will keep the order of the indexed
+property persisted in the repository.
+
+Used to speed-up queries with `ORDER BY` clause, _equality_ and
+_range_ ones.
+
+    SELECT * FROM [nt:base] ORDER BY jcr:lastModified
+    
+    SELECT * FROM [nt:base] WHERE jcr:lastModified > $date
+    
+    SELECT * FROM [nt:base] WHERE jcr:lastModified < $date
+    
+    SELECT * FROM [nt:base]
+    WHERE jcr:lastModified > $date1 AND jcr:lastModified < $date2
+
+    SELECT * FROM [nt:base] WHERE [jcr:uuid] = $id
+
+To define a property index on a subtree you have to add an index
+definition node that:
+
+* must be of type `oak:QueryIndexDefinition`
+* must have the `type` property set to __`ordered`__
+* contains the `propertyNames` property that indicates what properties
+  will be stored in the index.  `propertyNames` has to be a single
+  value list of type `Name[]`
+
+_Optionally_ you can specify
+
+* the `reindex` flag which when set to `true`, triggers a full content
+  re-index.
+* The direction of the sorting by specifying a `direction` property of
+  type `String` of value `ascending` or `descending`. If not provided
+  `ascending` is the default.
+* The index can be defined as asynchronous by providing the property
+  `async=async`
+
+_Caveats_
+
+* In case deploying on the index on a clustered mongodb you have to
+  define it as asynchronous by providing `async=async` in the index
+  definition. This is to avoid cluster merges.
+
 ### The Lucene Full-Text Index
 
 The full-text index handles the 'contains' type of queries: