Background:
The search condition must be placed in the query and cannot be set to FQ.
// Edit querystr; solrquery query = new solrquery (querystr); query. sethighlight (true); // enable the highlighting component query. addhighlightfield ("title"); // The highlighted field query. addhighlightfield ("content"); // The highlighted field query. sethighlightsimplepre ("<font color = \" Red \ ">"); // mark query. sethighlightsimplepost ("</font>"); query. sethighlightsnippets (1); // Number of result partitions. The default value is 1 query. sethighlightfragsize (100); // Maximum length of each slice. The default value is 100 queryrequest = new queryr. Equest (query); queryrequest. setpath (querypath); RSp = queryrequest. process (solrserver); // edit the keyfor (solrdocument dolrdoc: RSp. getresults () {content = ""; Title = ""; Map <string, Object> DATA = new hashmap <string, Object> (); If (dolrdoc. getfieldvalue ("ID ")! = NULL) {If (HL. Get (dolrdoc. getfieldvalue ("ID"). Get ("content ")! = NULL) {content = Hl. get (dolrdoc. getfieldvalue ("ID ")). get ("content "). get (0);} If (HL. get (dolrdoc. getfieldvalue ("ID ")). get ("title ")! = NULL) {Title = hl. Get (dolrdoc. getfieldvalue ("ID"). Get ("title"). Get (0 );}}}
Image effect: