Once you have bootstrapped a HippoQuery through the HippoSolrClient, you have access to the SolrQuery and its entire API, also see If you are familiar with Solrj, you'll be able to use whatever you were used to. If you are not familiar with it, you should easily find your way with the solrj documentation, see

Getting the SolrQuery


HippoSolrClient solrClient = HstServices.getComponentManager().getComponent(
                     HippoSolrClient.class.getName(), "org.hippoecm.hst.solr");
HippoQueryParser parser = solrClient.getQueryParser();
HippoQuery hippoQuery = solrClient.createQuery(parser.escape(query));
SolrQuery solrQuery = hippoQuery.getSolrQuery();

A simple example: Add sorting on date

SolrQuery solrQuery = hippoQuery.getSolrQuery();
solrQuery.addSortField("date", SolrQuery.ORDER.desc);

A simple example: Add highlighting for title and summary in the search results

SolrQuery solrQuery = hippoQuery.getSolrQuery();
solrQuery.setHighlightSimplePre("<b style=\"color:blue\">");

A simple example: Add highlighting in all fields


A simple example: Add spellcheck / did you mean

SolrQuery solrQuery = hippoQuery.getSolrQuery();
solrQuery.add("spellcheck", "true");
solrQuery.add("spellcheck.q", query);
solrQuery.add("spellcheck.extendedResults", "true");
solrQuery.add("spellcheck.collateExtendedResults", "true");
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?

    We rely on cookies

    to optimize our communication and to enhance your customer experience. By clicking on the Accept and Close button, you agree to the collection of cookies. You can also adjust your preferences by clicking on Manage Preferences. For more information please see our Privacy policy.

    Manage cookies
    Accept & close

    Cookies preferences

    Accept & close