HistorySearchHandler implements OmniSearchHandler { @Override public Query getSuggestionQuery(ResourceResolver resourceResolver, String searchTerm) { try { Session session = resourceResolver.adaptTo(Session.class); if (session == null) { return null; } final String queryStr = "SELECT [rep:suggest()] FROM [dam:Asset] as s WHERE SUGGEST($searchTerm) AND ISDESCENDANTNODE([" + HistoryUtil.HISTORY_BASE + "])"; final Query query = setupQuery(session, queryStr); ValueFactory valueFactory = session.getValueFactory(); query.bindValue("searchTerm", valueFactory.createValue(searchTerm)); return query; } catch (RepositoryException e) { LOG.error("Unable to create spell check query", e); } return null; }  @Override String getID(); @Override Resource getModuleConfig(ResourceResolver resourceResolver); @Override List<PredicateSuggestion> getPredicateSuggestions(ResourceResolver arg0, I18n arg1, String arg2); @Override SearchResult getResults(ResourceResolver resolver, Map<String, Object> predicateParameters, long limit, long offset); @Override Query getSpellCheckQuery(ResourceResolver resourceResolver, String searchTerm); @Override Query getSuggestionQuery(ResourceResolver resourceResolver, String searchTerm);  }
@Test public void getSuggestionQuery() { assertEquals(jcrQuery, handler.getSuggestionQuery(resolver, "")); }