What is the solr4.7 highlighting method
This article mainly explains the "solr4.7 highlighting method is what", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "solr4.7 highlighting method is what" it!
The first is the solrj operation:
Public SolrDocumentList query (String str) {SolrQuery query = new SolrQuery (str); query.setHighlight (true); / / enable highlight query.addHighlightField ("name,content"); / / highlight fields: multiple fields can be separated by spaces or commas query.setHighlightSimplePre (""); / / render label query.setHighlightSimplePost (""); / / render tag query.setParam ("f.content.hl.fragsize", "200") QueryResponse qr=server.query (query); / / execute the query SolrDocumentList dlist=qr.getResults (); System.out.println ("Total:" + dlist.getNumFound ()); / / the key of the first Map is the ID of the document, and the key of the second Map is the highlighted field name Map map = qr.getHighlighting (); for (int item0)