Example of a Result Set Descriptor

The example in this section shows how to use a Result Set Descriptor (or RSD). The following example requests a hitlist with the top 10 hits (ordered by score), plus the count of the total number of results.

<ctx_result_set_descriptor>
  <hitlist start_hit_num="1" end_hit_num="10" order="SCORE DESC">
    <rowid />
    <sdata name="title" />
    <sdata name="author" />
    <sdata name="articledate" />
    <snippet radius="20" max_length="160" starttag="&lt;b&gt;" endtag="&lt;/b&gt;" />
  </hitlist>
  <count />
</ctx_result_set_descriptor>

For each hit, you are requesting the rowid (which you could use to fetch further information about the row, if necessary), the contents of the SDATA fields or columns called title, author and articledate, and a snippet (which is a short summary with keywords highlighted, in this case by <b>...</b>).