Search Results get_sr_snippet




Overview

CS_KB_KWIC_UTIL is a PL/SQL utility package owned by the APPS schema in Oracle E-Business Suite releases 12.1.1 and 12.2.2. It belongs to the Oracle Service (CS) Knowledge Base module and supports the Keywords In Context (KWIC) implementation used by Knowledge Base search and display functionality. The package source file, cskbkwics.pls, carries a header dated 2005 and is classified in the ETRM repository as a utility (UTIL) API rather than a business-critical or public API. Its central responsibility is to take a user-supplied text query along with a stored document or excerpt and return a rendered string in which matching query terms are wrapped in caller-provided start and end tags, enabling highlighted presentation of search results in the Knowledge Base user interface.

The package encapsulates the text-manipulation logic required to build search-result snippets. Rather than exposing raw stored content, it produces trimmed, marked-up fragments that show the context surrounding matched keywords, which is the standard behavior expected from a KWIC-style search facility.

Key Procedures and Functions

The package exposes four documented functions, all returning VARCHAR2 output intended for direct display or further processing:

  • HIGHLIGHT_TEXT — Applies highlighting to a supplied document body given a text query and the start and end tags to insert around each match. It is the general-purpose highlighting routine underlying the more specialized snippet functions.
  • GET_SET_SNIPPET — Returns a highlighted snippet for a Knowledge Base set identified by set ID. It is the entry point used when search results are grouped by knowledge set.
  • GET_SR_SNIPPET — Returns a highlighted snippet for a Knowledge Base solution or search result identified by its solution/result ID, supporting result-by-result rendering in search output.
  • GET_SEGMENT_KWIC — Produces the KWIC output for a document supplied as a CLOB, accepting the text query plus the start and end tags. The CLOB parameter allows it to process large document segments that exceed the VARCHAR2 limit.

The signature details above reflect the documented package specification. No parameter lists beyond those shown in the specification should be assumed.

Tables Accessed

ETRM records the following objects as referenced by the package through APPS synonyms:

  • CS_KB_SET_ELES — Stores the elements that make up Knowledge Base sets. GET_SET_SNIPPET draws on this table to locate the content belonging to a given set ID before highlighting it.
  • CTX_DOC — The Oracle Text document API, invoked to retrieve stored document text and related highlighting services from the Text index infrastructure.
  • DBMS_LOB — Oracle's supplied LOB package, used to read and manipulate CLOB content, notably for GET_SEGMENT_KWIC.
  • PLITBLM — A PL/SQL internal table type used for intermediate collections during text processing.

Access to these objects is read-oriented: the package consumes stored knowledge content and returns formatted strings rather than persisting data.

Usage Notes

CS_KB_KWIC_UTIL is an internal utility layer. Because it is referenced by no other documented packages and is classified as UTIL, it is typically invoked indirectly from Knowledge Base search and result-display code paths — for example, from Oracle Forms or OAF pages in the Service responsibility that present Knowledge Base search results, or from concurrent and custom programs that need consistent keyword highlighting. Callers pass a search string and the desired markup tags, then use the returned VARCHAR2 directly in the rendered page.

Given its utility classification and the age of the source header, customizations should treat the package as stable but unsupported for direct modification. Any custom code invoking it should supply tags that are valid for the target rendering context and should be prepared for the possibility that highlighting is performed through Oracle Text facilities, which require the relevant Text indexes to be present and valid.