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 Mark Ferguson <ma...@gmail.com> on 2008/12/12 00:30:30 UTC

Format of highlighted fields in query response

Hello,

I am making a query to my Solr server in which I would like to have a number
of fields returned, with highlighting if available. I've noticed that in the
query response, I get back both the original field name and then in a
different section, the highlighted snippet. I am wondering if there is a
parameter which will allow me to collapse this data, returning only the
highlighted snippet in the doc itself, when available. For example, I am
currently receiving the following data:

<doc>
  <float name="score">0.2963915</float>
  <str name="page_title">Chinese Visa Information</str>
  <str name="url">
http://www.danwei.org/china_information/chinese_visa_information.php</str>
  <str name="urlmd5">01598a6e06190bd8b05c8b03f51233a1</str>
</doc>
... and farther down ...
<lst name="highlighting">
  <lst name="01598a6e06190bd8b05c8b03f51233a1">
    <arr name="page_title">
      <str>TITLE: <span class='highlight'>Chinese</span> Visa
Information</str>
    </arr>
  </lst>
</lst>

I would like it to just look like this:

<doc>
  <float name="score">0.2963915</float>
  <str name="page_title"><span class='highlight'>Chinese</span> Visa
Information</str>
  <str name="url">
http://www.danwei.org/china_information/chinese_visa_information.php</str>
  <str name="urlmd5">01598a6e06190bd8b05c8b03f51233a1</str>
</doc>

The reason I would prefer this second response format is because I don't
need the first field, and it greatly simplifies my call to
QueryResponse.getBeans() in SolrJ, as it will fill in everything I need in
one call.

Thanks very much,

Mark Ferguson