Hippo Search Service - Bloomreach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.


Hippo Search Service

The Hippo Search Service is intended to be used by the Advanced Search CMS feature. Within a delivery tier implementation, it is recommended to use the HST Search API instead.

The Hippo Search Service

The Hippo Search Service allows one to build queries using a Java DSL. A brief preview assuming the namespace of your project is myproject.

Search fluent API example:

import org.onehippo.cms7.services.search.service.SearchServiceFactory;
import org.onehippo.cms7.services.search.service.SearchService
import static org.onehippo.cms7.services.search.query.QueryUtils.both;
import static org.onehippo.cms7.services.search.query.QueryUtils.date;
import static org.onehippo.cms7.services.search.query.QueryUtils.either;
import static org.onehippo.cms7.services.search.query.QueryUtils.integer;
import static org.onehippo.cms7.services.search.query.QueryUtils.not;
import static org.onehippo.cms7.services.search.query.QueryUtils.text;

public class SearchExample {

   public void doSearch() throws SearchServiceException, RepositoryException {

        SearchServiceFactory searchServiceFactory =
                HippoServiceRegistry.getService(SearchServiceFactory.class, Session.class.getName());
        if (searchServiceFactory == null) {
            throw new SearchServiceException();

        SearchService searchService =

        Query query = searchService.createQuery()
                    .and(date("hippostdpubwf:publicationDate").from(new Date()).andTo(new Date()))

        QueryResult result = searchService.search(query);
        HitIterator hits = result.getHits();
        while (hits.hasNext()) {
            Hit hit = hits.next();
            String id = hit.getSearchDocument().getContentId().toIdentifier();
            Node documentNode = UserSession.get().getJcrSession().getNodeByIdentifier(id);
            // do stuff


The fluent API will guide you through the different parts of the query. A number of static helper methods (text, date, not, ...) are available to keep the constraints readable.

Note that there's no JCR code involved; this is intentional as the API is intended to support multiple implementations.

The DEFAULT resolution of date range searches is DAY. You can specify in #isEqualTo, #from and #to a different resolution. The bigger the resolution, the faster the query.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?