You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bent Jensen <be...@yahoo.com> on 2011/12/13 18:08:01 UTC
reposting highlighting questions
I am new to solr/xml/xslt, and trying to figure out how to display search query fields highlighted in html. I can enable the highlighting in the query, and I think I get the correct xml response back (See below: I search using 'Contents' and the highlighting is shown with <strong> and </strong>. However, I cannot figure out what to add to the xslt file to transform it in html. I think it is a question of defining the appropriate xpath(?), but I am stuck. Can someone point me in the right direction? Thanks in advance!
Here is the result I get back:
<?xml version="1.0" encoding="UTF-8" ?>
<http://us.mg4.mail.yahoo.com/neo/> - <response>
<http://us.mg4.mail.yahoo.com/neo/> - <lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">20</int>
<http://us.mg4.mail.yahoo.com/neo/> - <lst name="params">
<str name="explainOther" />
<str name="indent">on</str>
<str name="hl.simple.pre">'<strong>'</str>
<str name="hl.fl">*</str>
<str name="wt" />
<str name="hl">on</str>
<str name="rows">10</str>
<str name="version">2.2</str>
<str name="fl" />
<str name="start">0</str>
<str name="q">contents</str>
<str name="hl.simple.post">'</strong>'</str>
<str name="qt" />
<str name="fq" />
</lst>
</lst>
<http://us.mg4.mail.yahoo.com/neo/> - <result name="response" numFound="1" start="0">
<http://us.mg4.mail.yahoo.com/neo/> - <doc>
<http://us.mg4.mail.yahoo.com/neo/> - <arr name="content">
<str>Start with the Table of Contents. See if you can find the topic that you are interested in. Look through the section to see if there is a resource that can help you. If you find one, you may want to attach a Post-it tab so you can find the page later. Write down all of the information that you need to find out more information about the resource: agency name, name of contact person, telephone number, email and website addresses. If you were unable to find a resource that will help you in this resource guide, a good first step would be to call your local Independent Living Center. They will have a good idea of what is available in your area. A second step would be to call or email us at the Rehabilitation Research Center. We have a ROBOT resource specialist who may be able to assist. </str>
</arr>
<http://us.mg4.mail.yahoo.com/neo/> - <arr name="doclink">
<str>robot.pdf#page=11</str>
</arr>
<str name="heading1">CHAPTER 1: How to Use This Resource Guide</str>
<str name="id">1-1</str>
</doc>
</result>
<http://us.mg4.mail.yahoo.com/neo/> - <lst name="highlighting">
<http://us.mg4.mail.yahoo.com/neo/> - <lst name="1-1">
<http://us.mg4.mail.yahoo.com/neo/> - <arr name="content">
<str>Start with the Table of '<strong>'Contents'</strong>'. See if you can find the topic that you are interested in. Look</str>
</arr>
</lst>
</lst>
</response>
_____
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1873 / Virus Database: 2108/4678 - Release Date: 12/13/11
Re: reposting highlighting questions
Posted by Chris Hostetter <ho...@fucit.org>.
: I am new to solr/xml/xslt, and trying to figure out how to display
: search query fields highlighted in html. I can enable the highlighting
: in the query, and I think I get the correct xml response back (See
: below: I search using 'Contents' and the highlighting is shown with
: <strong> and </strong>. However, I cannot figure out what to add to the
: xslt file to transform it in html. I think it is a question of defining
i think you are looking for the disable-output-escaping="yes" option on
your <xsl:value-of select="..."/> expression to echo out the highlighted
string. hard to be sure since you didn't actaully provide any example of
the XSLT or xpath you are trying to use.
-Hoss