Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Spell Check in AEM 5.6.1

Avatar

Level 4

Trying to enable spell check in AEM 5.6.1

which i did http://wiki.apache.org/jackrabbit/SpellChecker...See the attachment. What it does is it index my entire content into spell Check lucene folder  \crx-quickstart\repository\workspaces\crx.default\index\spellchecker of let us 100 MB..and bring the suggestion from there...which seems not a good solution.

    String termNew = null;
        try{
            final QueryManager manager = session.getWorkspace().getQueryManager();
            Query query = manager.createQuery("/jcr:root[rep:spellcheck('"+term+"')]/(rep:spellcheck())", Query.XPATH);
            RowIterator rows = query.execute().getRows();
            // the above query will always return the root node no matter what string we check
            Row r = rows.nextRow();
            // get the result of the spell checking
            Value v = r.getValue("rep:spellcheck()");
            if (v == null) {
                termNew = term;
            } else {
                 termNew = v.getString();
            }          
        }
        catch(Exception ex){
            System.out.println(ex.getMessage() +"111");
            log.error("error caught in getSpelledChecked",ex.getMessage());
        }
        System.out.println(" Source >> "+ term + " Suggestion>> "+termNew);
        return termNew

https://github.com/sahilthadhani/cq-aem-spellchecker is not looking suitable for single term or phrase search.

Any thoughts?

Regards,

Chandra

 

 

 

;

0 Replies