Expand my Community achievements bar.

AEM Suggester Index

Avatar

Level 1

Hi. I'm using AEM 6.4 and using the out of the box Suggester service like this:

for (final String suggestion : suggester.getSuggestions(session, INDEX, keyword, spellCheck)) {

[...]

suggestions.add(suggestion);

}


where INDEX is :

private static final String INDEX = "oak-cq:Page";



The suggester works great, returning what I'm expecting, with one small problem.

I want to only have suggestions from my project, not from we-retail as well.


I've tried making a custom index "lucene-suggest" and put it below my content/desiredProject. But, I don't know how to have my suggester use this index.


Any help is welcomed,

Thank you.

5 Replies

Avatar

Level 8

Just a thought.

Are you having we-retail content in the production environment. Guess we can exclude those pages.

Avatar

Level 1

In production environment I will have two other projects on the same instance. I tried to simplify this by saying we-retail.

So there will be no we-retail, but there will be others.

Avatar

Employee Advisor

You can use Include/Exclude paths property on the index so that it is only indexing custom project related pages.Also, starting AEM instance with nosamplecontent will remove the we-retail content. Check [1] for more details

[1] Jackrabbit Oak – Lucene Index

Avatar

Level 1

I may have not made myself understood.

This is not an index configuring problem, but, my problem is that I do not know how to reference the index I've created in my suggester.

Avatar

Employee Advisor

You can use the AEM explain tool to see if your query is picking your index or not. If it is picking some OOTB index then you can compare and understand why the cost of OOTB index is less than yours.  Please refer to [1] for creating index as per your query and [2] for details on explain query tool.

[1] Oak Utilities : Index Definition Generator

[2] Operations Dashboard