Parse a query input to valid Solr syntax
Through the HippoSolrClient you can access the HippoQueryParser, which is a utility to escape all chars that Solr/Lucene QueryParser expects to be escaped (for example '+', '-', ':', '~' etc)
Code snippet how to escape a user input query:
@Overridepublic void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException { HippoSolrClient solrClient = HstServices.getComponentManager() .getComponent(HippoSolrClient.class.getName(), "org.hippoecm.hst.solr"); String escapedQuery = solrManager.getQueryParser().escape(query); HippoQuery hippoQuery = solrClient.createQuery(escapedQuery); HippoQueryResult result = hippoQuery.execute(); request.setAttribute("result", result); }