SEARCHPIPELINE

Use the standard table function DBMS_HYBRID_VECTOR.SEARCHPIPELINE to return a pipeline of row records.

This pipeline function accepts valid JSON query input and returns a pipeline of row records. The syntax is as shown below:

FUNCTION SEARCHPIPELINE(qparams JSON)
RETURN results PIPELINED;
The results is of type RECORD. The results contains the following fields:

The record members are the column names in the SELECT statement. These names are the same as the JSON field names that are returned in DBMS_HYBRID_VECTOR_SEARCH(), except that paths is a list of field IDs in the record, where as the JSON result maps the ids to their actual paths (in an array). Also note that the result record could not have a member named rowid nor a member with a rowid type.

Example 12-1

SELECT
   chartorowid(doc_rowid) as doc_rowid,
   score,
   vector_score,
   text_score,
   vector_rank,
   text_rank,
   chunk_text,
   chunk_id,
   paths
FROM dbms_hybrid_vector.searchpipeline(JSON('{"hybrid_index_name" : "idx",
                                              "search_text" : "teamwork" }'));

If you do not wish to use the table function DBMS_HYBRID_VECTOR.SEARCHPIPELINE(), the original SEARCH API can be wrapped in a JSON_TABLE specification. This is shown in the example below:

SELECT jt.*
FROM
   JSON_TABLE(
        dbms_hybrid_vector.search(
                      json_object('hybrid_index_name' value 'idx',
                      'search_text' value 'teamwork'
                      RETURNING JSON)
                   ),
                   '$[*]' COLUMNS idx for ORDINALITY,
                                  doc_rowid PATH '$.rowid',
                                  score NUMBER PATH '$.score',
                                  vector_score NUMBER PATH '$.vector_score',
                                  text_score NUMBER PATH '$.text_score',
                                  vector_rank NUMBER PATH '$.vector_rank',
                                  text_rank NUMBER PATH '$.text_rank',
                                  chunk_text PATH '$.chunk_text',
                                  chunk_id PATH '$.chunk_id',
                                  paths PATH '$.paths'
                    ) jt
ORDER by idx ASC