Ordering By SDATA Sections

You can order the query results according to the content of SDATA sections using the <order> and <orderkey> elements of the query template.

In the following example, the first level of ordering is done on the SDATA section price, which is sorted in the ascending order. The second and third level of ordering is done by the SDATA section pub_date and score, both of which are sorted in the descending order.

select id from docs where CONTAINS (text, '
<query>
   <textquery lang="ENGLISH" grammar="CONTEXT"> Oracle </textquery>
   <score datatype="INTEGER" algorithm="COUNT"/>
   <order>
       <orderkey> SDATA(price) ASC </orderkey>
       <orderkey> SDATA(pub_date) DESC </orderKey>
       <orderkey> Score DESC </orderkey>
   </order>
</query>', 1)>0;

Note:

You can add additional SDATA sections to an index without completely rebuilding the index. Refer to the ADD SDATA SECTION parameter string under ALTER INDEX in Oracle Text Reference.

See Also:

Oracle Text Reference for syntax of <order> and <orderkey> elements of the query template