Switch between AND and OR operator

By default, the operator for searches is OR. Thus searching for 'hippo cms' returns results for documents containing 'hippo' or 'cms' or both terms. The default can be changed in your Solr schema.xml

<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
<solrQueryParser defaultOperator="OR"/>

If you want to switch query time to AND operator, you can do this through:

Switch default operator:

HippoSolrClient solrClient =
      HstServices.getComponentManager().getComponent(
                    HippoSolrClient.class.getName(), "org.hippoecm.hst.solr");
// set the q operator to AND
query = "{!q.op=AND}" + query;
HippoQuery hippoQuery = solrClient.createQuery(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?

    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
    Back