Author: tommaso
Date: Wed Dec 2 16:00:04 2015
New Revision: 1717655
URL: http://svn.apache.org/viewvc?rev=1717655&view=rev
Log:
OAK-3509, OAK-3686 - updated oak doc for per row spellchecks / suggestions
Modified:
jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/lucene.md
jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/query.md
Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/lucene.md
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/lucene.md?rev=1717655&r1=1717654&r2=1717655&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/lucene.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/lucene.md Wed Dec 2
16:00:04 2015
@@ -961,8 +961,6 @@ property.
- useInSuggest = true
```
-`@since Oak 1.3.11` each suggestion would be returned per row.
-
`@since Oak 1.3.12` the index Analyzer can be used to perform a have more fine
grained suggestions, e.g. single words
(whereas default suggest configuration returns entire property values, see
[OAK-3407]: https://issues.apache.org/jira/browse/OAK-3407).
Analyzed suggestions can be enabled by setting "suggestAnalyzed" property to
true, e.g.:
Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/query.md
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/query.md?rev=1717655&r1=1717654&r2=1717655&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/query.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/query/query.md Wed Dec 2
16:00:04 2015
@@ -157,6 +157,8 @@ The result of such a query will be a JCR
index, in a special property named `rep:spellcheck()`.
Clients wanting to obtain spellchecks could use the following JCR code:
+
+`@until Oak 1.3.10` spellchecks are returned flat.
QueryManager qm = ...;
String xpath = "/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())";
@@ -167,10 +169,23 @@ Clients wanting to obtain spellchecks co
spellchecks = row.getValue("rep:spellcheck()").getString()
}
-If either Lucene or Solr were configured to provide the spellcheck feature,
see [Enable spellchecking in Lucene](lucene.html#Spellchecking) and [Enable
-spellchecking in Solr](solr.html#Spellchecking), the `spellchecks` String
would be have the following pattern `\[[\w|\W]+(\,\s[\w|\W]+)*\]`, e.g.:
+The `spellchecks` String would be have the following pattern
`\[[\w|\W]+(\,\s[\w|\W]+)*\]`, e.g.:
[hello, hold]
+
+`@since Oak 1.3.11` each spellcheck would be returned per row.
+
+ QueryManager qm = ...;
+ String xpath = "/jcr:root[rep:spellcheck('helo')]/(rep:spellcheck())";
+ QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
+ RowIterator it = result.getRows();
+ List<String> spellchecks = new LinkedList<String>();
+ while (it.hasNext()) {
+ spellchecks.add(row.getValue("rep:spellcheck()").getString());
+ }
+
+If either Lucene or Solr were configured to provide the spellcheck feature,
see [Enable spellchecking in Lucene](lucene.html#Spellchecking) and [Enable
+spellchecking in Solr](solr.html#Spellchecking)
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.
@@ -190,6 +205,8 @@ The result of such a query will be a JCR
suggested and scored by the used underlying index, in a special property named
`rep:suggest()`.
Clients wanting to obtain suggestions could use the following JCR code:
+
+`@until Oak 1.3.10` suggestions are returned flat.
QueryManager qm = ...;
String xpath = "/jcr:root[rep:suggest('in ')]/(rep:suggest())";
@@ -200,6 +217,17 @@ Clients wanting to obtain suggestions co
suggestions = row.getValue("rep:suggest()").getString()
}
+`@since Oak 1.3.11` each suggestion would be returned per row.
+
+ QueryManager qm = ...;
+ String xpath = "/jcr:root[rep:suggest('in ')]/(rep:suggest())";
+ QueryResult result = qm.createQuery(xpath, Query.XPATH).execute();
+ RowIterator it = result.getRows();
+ List<String> suggestions = new LinkedList<String>();
+ while (it.hasNext()) {
+ suggestions.add(row.getValue("rep:suggest()").getString());
+ }
+
If either Lucene or Solr were configured to provide the suggestions feature,
see [Enable suggestions in Lucene](lucene.html#Suggestions) and [Enable
suggestions in Solr](solr.html#Suggestions), the `suggestions` String would be
have the following pattern
`\[\{(term\=)[\w|\W]+(\,weight\=)\d+\}(\,\{(term\=)[\w|\W]+(\,weight\=)\d+\})*\]`,
e.g.: