0

拼写检查在 AEM 6.1 中不起作用,即使在创建建议的索引(如 --

https://docs.adobe.com/docs/en/aem/6-1/deploy/platform/queries-and-indexing.html

https://jackrabbit.apache.org/oak/docs/query/lucene.html

根据文档,自 1.1.17 和 1.0.13 版本以来,OAK 中已经实现了拼写检查。我的 OAK 版本是 1.22,所以它应该可以工作。AEM 版本是 6.1.0.20150507

创建了一个索引,例如-

/oak:index/lucene-spellcheck
  - jcr:primaryType = "oak:QueryIndexDefinition"
  - compatVersion = 2
  - type = "lucene"
  - async = "async"
  + indexRules
    - jcr:primaryType = "nt:unstructured"
    + nt:base
      + properties
        - jcr:primaryType = "nt:unstructured"
        + jcr:title
          - propertyIndex = true
          - analyzed = true
          - useInSpellcheck = true

当我使用 CRX-DE 的查询工具以及使用 jsp 中的查询管理器运行此查询时,我得到零结果。

SELECT [rep:spellcheck()] FROM nt:base WHERE [jcr:path] = '/content/abc' AND SPELLCHECK('tetspage')

(“testpage”是一个页面;拼错为“tetspage”)

如文档中所述运行此查询

SELECT [rep:spellcheck()] FROM nt:base WHERE [jcr:path] = '/' AND SPELLCHECK('jackrabit')

返回单个节点。

我做错什么了吗?这个索引在任何人的 AEM 6.1 中都有效吗?

4

2 回答 2

1

这个查询对我有用

SELECT [rep:spellcheck()] FROM [nt:base] WHERE SPELLCHECK('tetspage') AND ISDESCENDANTNODE('/content/abc')
于 2016-11-28T16:25:34.497 回答
0

我在“rep:suggest()”查询中遇到了类似的问题,而不是“rep:spellcheck()”,但也许该解决方案对您有用。

当我直接在 CRX DE 中尝试查询时,结果是单个节点,并且我在该节点上看不到任何内容。但是,从我的代码执行查询时,我发现查询的结果存储为“行”。为了处理我使用此代码的“行”,希望它对您有所帮助:

String sql = "SELECT [rep:suggest()] FROM cq:PageContent WHERE ISDESCENDANTNODE('" + path + "/') AND SUGGEST('" + text + "')";
Query q = qm.createQuery(sql, Query.SQL);

List<String> results = Lists.newArrayList();  // <--- Actual query results
RowIterator it = q.execute().getRows();
while (it.hasNext()) {
    Row row = it.nextRow();
    results.add(row.getValue("rep:suggest()").getString());
}
于 2019-03-27T16:21:35.217 回答