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 2018/12/08 22:48:39 UTC
svn commit: r1848488 - /jackrabbit/site/live/oak/docs/query/lucene.html
Author: catholicon
Date: Sat Dec 8 22:48:39 2018
New Revision: 1848488
URL: http://svn.apache.org/viewvc?rev=1848488&view=rev
Log:
OAK-301: Document Oak
Modified:
jackrabbit/site/live/oak/docs/query/lucene.html
Modified: jackrabbit/site/live/oak/docs/query/lucene.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/query/lucene.html?rev=1848488&r1=1848487&r2=1848488&view=diff
==============================================================================
--- jackrabbit/site/live/oak/docs/query/lucene.html (original)
+++ jackrabbit/site/live/oak/docs/query/lucene.html Sat Dec 8 22:48:39 2018
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<!--
- | Generated by Apache Maven Doxia Site Renderer 1.8.1 at 2018-12-08
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 at 2018-12-09
| Rendered using Apache Maven Fluido Skin 1.6
-->
<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="20181208" />
+ <meta name="Date-Revision-yyyymmdd" content="20181209" />
<meta http-equiv="Content-Language" content="en" />
<title>Jackrabbit Oak – Lucene Index</title>
<link rel="stylesheet" href="../css/apache-maven-fluido-1.6.min.css" />
@@ -142,7 +142,7 @@
<div id="breadcrumbs">
<ul class="breadcrumb">
- <li id="publishDate">Last Published: 2018-12-08<span class="divider">|</span>
+ <li id="publishDate">Last Published: 2018-12-09<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 1.10-SNAPSHOT</li>
</ul>
@@ -326,6 +326,7 @@
<li><a href="#uc2">UC2 - Find all assets which are having <tt>status</tt> as <tt>published</tt> sorted by last modified date</a></li>
<li><a href="#uc3">UC3 - Find all assets where comment contains <i>december</i></a></li>
<li><a href="#uc4">UC4 - Find all assets which are created by David and refer to december</a></li>
+<li><a href="#uc5">UC5 - Facets</a></li>
</ul>
</li>
</ul>
@@ -1434,7 +1435,7 @@ Copied 8.5 MB in 218.7 ms
- propertyIndex = true
</pre></div></div>
-<p>See <a href="query-engine.html#Facets">query-engine</a> regarding how to query to evaluate facets alongwith.</p></div>
+<p>See <a href="query-engine.html#Facets">query-engine</a> regarding how to query to evaluate facets alongwith. Also check out some examples of queries and required index definitions for faceting in <a href="#uc5">use case 5</a>.</p></div>
<div class="section">
<h4><a name="Score_Explanation"></a><a name="score-explanation"></a>Score Explanation</h4>
<p><tt>@since Oak 1.3.12</tt></p>
@@ -1837,7 +1838,114 @@ WHERE
- nodeScopeIndex = true
- name = "jcr:content/metadata/jcr:title"
- boost = 2.0
-</pre></div></div></div></div></div>
+</pre></div></div>
+
+<div class="section">
+<h5><a name="UC5_-_Facets"></a><a name="uc5"></a>UC5 - Facets</h5>
+<p>Unconstrained queries for facets like</p>
+
+<div>
+<div>
+<pre class="source"> SELECT [rep:facet(title)] FROM [app:Asset]
+or
+ //element(*, app:Asset)/(rep:facet(title))
+or
+ SELECT [rep:facet(title)], [rep:facet(tags)] FROM [app:Asset]
+or
+ //element(*, app:Asset)/(rep:facet(title) | rep:facet(tags))
+</pre></div></div>
+
+<p>would require an index on <tt>app:Asset</tt> containing all nodes of the type. That, in turn, means that either the index needs to be a fulltext index or needs to be indexing <tt>jcr:primaryType</tt> property. All of the following definitions would work for such a case:</p>
+
+<div>
+<div>
+<pre class="source"> + /oak:index/index1
+ - ...
+ + aggregates
+ + app:Asset
+ + include0
+ - path = "jcr:content"
+ + indexRules
+ + app:Asset
+ + properties
+ + title
+ - facets = true
+ + tags
+ - facets = true
+ - propertyIndex = true
+or
+ + /oak:index/index2
+ - ...
+ + indexRules
+ + app:Asset
+ + properties
+ + title
+ - facets = true
+ - nodeScopeIndex = true
+ + tags
+ - facets = true
+ - propertyIndex = true
+or
+ + /oak:index/index3
+ - ...
+ + indexRules
+ + app:Asset
+ + properties
+ + nodeType
+ - propertyIndex = true
+ - name = jcr:primaryType
+ + title
+ - facets = true
+ + tags
+ - facets = true
+</pre></div></div>
+
+<p>Another thing to note with facets is that facet counts are derived from lucene index. While not immediately obvious, that implies that any constraint on the query that do <b>not</b> get evaluated by the index are going to return incorrect facet counts as the other constraints would get filtered <i>after</i> collecting counts from the index.</p>
+<p>So, following queries require correspondingly listed indexes:</p>
+
+<div>
+<div>
+<pre class="source">SELECT rep:facet(title) FROM [app:Asset] WHERE ISDESCENDANTNODE(/some/path)
+
++ /oak:index/index2
+ - ...
+ - evaluatePathRestrictions = true
+ + indexRules
+ + app:Asset
+ + properties
+ + title
+ - facets = true
+ - propertyIndex = true
+</pre></div></div>
+
+<div>
+<div>
+<pre class="source">SELECT rep:facet(title) FROM [app:Asset] WHERE CONTAINS(., 'foo')
+
++ /oak:index/index2
+ - ...
+ + indexRules
+ + app:Asset
+ + properties
+ + title
+ - facets = true
+ - propertyIndex = true
+ - nodeScopeIndex = true
+</pre></div></div>
+
+<div>
+<div>
+<pre class="source">SELECT rep:facet(title) FROM [app:Asset] WHERE [title] IS NOT NULL
+
++ /oak:index/index2
+ - ...
+ + indexRules
+ + app:Asset
+ + properties
+ + title
+ - facets = true
+ - propertyIndex = true
+</pre></div></div></div></div></div></div>
</div>
</div>
</div>