Skip to content

adm_search_api

This document contains the API documentation for the adm_search_api package.

Return type for search results

Definition:

type r_search_result_type is record (
document_id adm_documents.document_id%type,
document_name adm_documents.document_name%type,
created_by adm_documents.created_by%type,
folder_id adm_documents.folder_id%type,
folder_path adm_folders.folder_path%type,
latest_version_id adm_documents.latest_version_id%type,
user_owner adm_documents.user_owner%type,
group_owner adm_documents.group_owner%type,
score number -- Oracle text search score
);

Fields:

NameTypeDescription
document_idadm_documents.document_id%type-
document_nameadm_documents.document_name%type-
created_byadm_documents.created_by%type-
folder_idadm_documents.folder_id%type-
folder_pathadm_folders.folder_path%type-
latest_version_idadm_documents.latest_version_id%type-
user_owneradm_documents.user_owner%type-
group_owneradm_documents.group_owner%type-
scorenumberOracle text search score

Collection type for search results

Definition:

type t_search_results is table of r_search_result_type;

Return type for search results

Signature:

function create_tag_facet (
p_tag_id in number
) return varchar2;

Parameters:

NameDirectionTypeDescription
p_tag_idinnumber-

Returns: varchar2


Creates a facet filter for tag group searches (any files that have that tag without a specification for the tag value)

See combine_facets for an example

Signature:

function create_tag_facet (
p_tag_id in number
) return varchar2;

Parameters:

NameDirectionTypeDescription
p_tag_idinnumberID of the tag

Returns: varchar2 - Formatted facet string: “G#tag_id”


Creates a facet filter for a tag with a value

See combine_facets for an example

Signature:

function create_tag_value_facet (
p_tag_id in number,
p_tag_value in varchar2
) return varchar2;

Parameters:

NameDirectionTypeDescription
p_tag_idinnumberID of the tag
p_tag_valueinvarchar2Specific value to match for this tag

Returns: varchar2 - Formatted facet string: “I#tag_id#tag_value”


Combines multiple facet strings into a single facets parameter

Usage example:

l_facets := adm_search_api.combine_facets(
apex_t_varchar2(
adm_search_api.create_tag(456),
adm_search_api.create_tag_value_facet(123, 'important'),
adm_search_api.create_tag_value_facet(789, 'high priority')
)
);

Signature:

function combine_facets (
p_facets in apex_t_varchar2
) return varchar2;

Parameters:

NameDirectionTypeDescription
p_facetsinapex_t_varchar2Array of individual facet strings

Returns: varchar2 - Combined facet string with colon separators


Searches documents based on search criteria and tags/taxonomy.

Example:

select *
from table(adm_search_api.search_documents(
p_search_expression => 'quarterly report',
p_dyn_facets => adm_search_api.combine_facets(
apex_t_varchar2(
adm_search_api.create_tag_facet(123),
adm_search_api.create_tag_value_facet(456, 'important')
)
),
p_facet_and_match => 'Y',
p_modified_after => systimestamp - 30
));

Signature:

function search_documents (
p_search_expression in varchar2 default null,
p_dyn_facets in varchar2 default null,
p_facet_and_match in varchar2 default 'N',
p_modified_after in timestamp with local time zone default null
) return t_search_results pipelined;

Parameters:

NameDirectionTypeDescription
p_search_expressioninvarchar2 default nullFull-text search expression (optional)
p_dyn_facetsinvarchar2 default nullDynamic facets in format: “G#tag_id:I#tag_id#tag_value:…”. See combine_facets on how to build such a string.
p_facet_and_matchinvarchar2 default 'N'’Y’ for AND matching (all tags), ‘N’ for OR matching (any tag)
p_modified_afterintimestamp with local time zone default nullFilter documents modified after this date (optional)

Returns: t_search_results pipelined - Pipelined table of search results


Searches user documents based on search criteria and tags/taxonomy. This only returns document a specific user has access to.

Example:

select *
from table(adm_search_api.search_documents(
p_username => 'DIMITRI',
p_search_expression => 'quarterly report',
p_dyn_facets => adm_search_api.combine_facets(
apex_t_varchar2(
adm_search_api.create_tag_facet(123),
adm_search_api.create_tag_value_facet(456, 'important')
)
),
p_facet_and_match => 'Y',
p_modified_after => systimestamp - 30
));

This function relies on a cached list of files shared with the user. This gets updated nightly and when the user is active in the app. To manually trigger a cache update call adm_cache_api.update_subshared_files_cache('USERNAME');

Signature:

function search_user_documents (
p_username in varchar2,
p_search_expression in varchar2 default null,
p_dyn_facets in varchar2 default null,
p_facet_and_match in varchar2 default 'N',
p_modified_after in timestamp with local time zone default null
) return t_search_results pipelined;

Parameters:

NameDirectionTypeDescription
p_usernameinvarchar2Username to search documents for
p_search_expressioninvarchar2 default nullFull-text search expression (optional)
p_dyn_facetsinvarchar2 default nullDynamic facets in format: “G#tag_id:I#tag_id#tag_value:…”. See combine_facets on how to build such a string.
p_facet_and_matchinvarchar2 default 'N'’Y’ for AND matching (all tags), ‘N’ for OR matching (any tag)
p_modified_afterintimestamp with local time zone default nullFilter documents modified after this date (optional)

Returns: t_search_results pipelined - Pipelined table of search results