Note that highlighting is NOT part of the document list returned. It's in an additional NamedList section of the response (with name="highlighting")

        Erik

On Jun 18, 2009, at 1:22 PM, Bruno wrote:

Hi guys.

I new at using highlighting, so probably I'm making some stupid mistake, however I'm not founding anything wrong.

I use highlighting from a query withing a EmbeddedSolrServer, and within the query I've set parameters necessary for enabling highlighting. Attached, follows my schema and solrconfig.xml , and down below follows the Java code. Content from the SolrDocumentList is not highlighted.

EmbeddedSolrServer server = SolrServerManager.getServerEv();
String queryString = filter;
SolrQuery query =

new SolrQuery();

query.setQuery(queryString);
query.setHighlight(true);
query.addHighlightField(LOG_FIELD);
query.setHighlightSimplePost("<i>");
query.setHighlightSimplePre("</i>");
query.set("hl.usePhraseHighlighter", true);
query.set("hl.highlightMultiTerm", true);
query.set("hl.snippets", 100);
query.set("hl.fragsize", 1);
query.set("hl.mergeContiguous", false);
query.set("hl.requireFieldMatch", false);
query.set("hl.maxAnalyzedChars", -1);

query.addSortField(DATE_FIELD, SolrQuery.ORDER.asc);
query .setFacetLimit (LogUtilProperties .getInstance ().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE, 10000)); query .setRows (LogUtilProperties .getInstance ().getProperty(LogUtilProperties.LOGEVENT_SEARCH_RESULT_SIZE, 10000));
query.setIncludeScore(true);
QueryResponse rsp = server.query(query);
SolrDocumentList docs = rsp.getResults();

--
Bruno Morelli Vargas
Mail: brun...@gmail.com
Msn: brun...@hotmail.com
Icq: 165055101
Skype: morellibmv

<schema.xml><solrconfig.xml>

Reply via email to