Expand my Community achievements bar.

SOLVED

Full-text Search Suggestion AEM 6.0

Avatar

Level 3

Hi all,

I am trying to achieve predictive search (suggestions) on AEM 6.0 with Apache Jackrabbit Oak 1.0.22. Following OAK documentation, since Oak 1.0.15, we are able to find suggestions for a given query by using Apache Lucene. Moreover, I have created an extra index to able full-text search with suggestion on the jcr:description property (see picture):

I have a page whose jcr:description is "This is my query word within the page description"

My back-end code is something like that:

            QueryManager qm = session.getWorkspace().getQueryManager();
            String query = "SELECT [rep:suggest()] FROM nt:base WHERE [jcr:path] = '/content/myproject' AND SUGGEST('query')";
            Query searchQuery = qm.createQuery(query, Query.SQL);
            RowIterator it = searchQuery.execute().getRows();

I get no results and the logs shows: org.apache.jackrabbit.oak.query.ast.SuggestImpl No full-text index was found that can process the condition suggest([nt:base], cast('query' as string))

However, if I query like that:

        queryMap.put("fulltext", "query");
        queryMap.put("path", "/content/myproject");
        final QueryBuilder queryBuilder = resourceResolver.adaptTo(QueryBuilder.class);
        return queryBuilder.createQuery(PredicateGroup.create(queryMap), session);

I get result -> the page with the description.

Could anybody give me a clue about why the suggestion query is not working? Why doesn't OAK find full-text indexes if there are two of them, the OOTB 'lucene' and the custom one 'lucene-suggestion' created by me?

Many thanks, Salvador.

1 Accepted Solution

Avatar

Correct answer by
Level 6
8 Replies

Avatar

Correct answer by
Level 6

Do you verified  description from below URL

http://www.aemstuff.com/blogs/feb/aemindexcheatsheat.html

Avatar

Level 2

i'm also getting the same issue with Oak 1.0.15, please let me know if you are able to resolve this issue.

Avatar

Level 10

Can you test this for any other word but query?

Avatar

Level 2

Its a problem with keyword  SUGGEST('any query value you may like to suggest')

Avatar

Level 3

Hi Gokul,

Thanks for this link, the index cheatsheat is great. Following this instructions, this is the new index created:

The jcr:description node has the following properties:

           
1
analyzed
Boolean
true
false
false
false
false
           
2
index
Boolean
true
false
false
false
false
           
3
jcr:primaryType
Name
nt:unstructured
true
true
false
true
           
4
name
String
jcr:description
false
false
false
false
       
5
useInSuggest
Boolean
true

However, I still have no result and the logs keep showing:

org.apache.jackrabbit.oak.query.ast.SuggestImpl No full-text index was found that can process the condition suggest([nt:base], cast('keyword' as string))

Why OAK does not find a full-text index if a lucene index has been created?!

Avatar

Level 3

Hi Amit,

As Sumantap said, the word 'query' was an example. It should be the user input. It throws this log all the time:

org.apache.jackrabbit.oak.query.ast.SuggestImpl No full-text index was found that can process the condition suggest([nt:base], cast('keyword' as string))

Cheers,

Salvador

Avatar

Level 1

Hi Salvador,

I am also getting the same issue with AEM 6.0 SP3. Did you find any fix for the same?

Thanks

Ravinder

Avatar

Level 2

Hi All,

I am also getting the same error. Could anyone let me know if you have the resolution for this.

Thanks,

Mayur