Using the JSON Result Set Interface

The CTX_QUERY.RESULT_SET() and CTX_QUERY.RESULT_SET_CLOB_QUERY() APIs enable you to obtain query results with a single query, rather than running multiple CONTAINS() queries to achieve the same result. The two APIs are identical except that one uses a VARCHAR2 query parameter, and the other uses a CLOB query parameter to allow for longer queries.

Usage

The input Result Set Descriptor (RSD) query consists of the following parts:

The result set output is of the following format:

{
  "$count" : number ,
  "$hit" :
  [
    {
      "score" : <search_score>,
      "rowid" : <rowid>,
      "project" : {"<sdata_name>" : <sdata_value>, ... }
    },
    ...
  ],
"$facets" :
  [
    {"<field>" : [ ..., { "value" : <value_i>, "$uniqueCount" : <group_count_i>}, ...  ]},
    {"<field>" : [ ..., { "bucket" : <bucket_object_i>, "<op>" : <group_count_i>}, ...  ]},
    {"<field>" : { "<op>" : <actual_value of the aggregation> } },
    ...
  ]
}

See Also: Oracle Text Reference for more information about CTX_QUERY.RESULT_SET procedure