Search in a specific Field instead of default field

By default, searches are done against the defaultSearchField configured in the Solr schema.xml

<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>

If you want to search only in a specific field, you can do this through specifying df

Search only in title:

HippoSolrClient solrClient =
      HstServices.getComponentManager().getComponent(
                    HippoSolrClient.class.getName(), "org.hippoecm.hst.solr");
// set the field to search in to title
query = "{!df=title}" + 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?