Just in case anyone wants to know: I figured out that you have to set uniqueKey stored="true" for highlighting to work. Thanks for everyone's help.
Thanks, - Kevin -----Original Message----- From: Kevin Xiao [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2008 11:22 PM To: solr-user@lucene.apache.org Subject: solr highlighting Hi there, I am new to solr. I want search term to be highlighted on the results. I thought it is pretty simple, but could not make it work. I read a lot of solr documents and mail archives (I wish there is a search function for this, we are talking about solr, aren’t we? ☺). Solrconfig.xml <requestHandler name="pm" class="solr.DisMaxRequestHandler" > <!-- default values for query parameters --> <lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">100</int> <str name="qf"> PMID AUTH ARTICLE_prefix_token ABST </str> <str name="pf"> ARTICLE </str> <str name="qs">1</str> <str name="bf"> recip(rord(DATE_1),1,1000,1000) </str> <!-- try highlighter: ABST indexed and stored --> <str name="hl">true</str> <str name="hl.fl">ABST</str> </lst> </requestHandler> We use a Java client, which is nothing but CommonsHttpSolrServer(“http://server:port/solr”), and populates the result to some data structure. Without the two lines for highlighter, I have results coming back, but after I add the two lines, the result is empty. I also used the admin utility, but I saw the ABST values are unchanged, but at the end of document added: <lst name="highlighting"> −<lst> −<arr name="ABST"> −<str> -gestational anemia as a consequence of a reduction in the number of primitive erythroid cells. <em>GATA</em>-<em>1</em> mRNA is </str> </arr> </lst> … </lst> The content of ABST of highlighting is much smaller than that of the original. I am guessing it tries to find the highlighted term’s position. So what should I do to get the highlighted ABST? Thanks, - Kevin