Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the solr4.7 highlighting method

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report