Tuesday, April 4, 2017

Search with Compass

Hey, we use an xml based compass in a project, working very well. Sometimes we run a reindexation, not more then two times a year.

The search is very easy:
CompassSearchHelper compassSearchHelper = new CompassSearchHelper(...);
CompassQuery query = compassSearchHelper.buildQuery(criteria);
CompassSearchCommand command = new CompassSearchCommand(query, pageNumber);
CompassSearchResults searchResults = compassSearchHelper.searchLocal(command);

You can also highlight the keywords in the search result.

run the indexation:
SingleCompassGps compassGps;
compassGps.index();

and the optimization:
compassGps.getIndexCompass().getSearchEngineOptimizer().optimize(numberOfSegments);

No comments:

Post a Comment