adm_search_api
This document contains the API documentation for the adm_search_api
package.
r_search_result_type
Section titled “r_search_result_type”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:
Name | Type | Description |
---|---|---|
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 |
t_search_results
Section titled “t_search_results”Collection type for search results
Definition:
type t_search_results is table of r_search_result_type;
Functions and Procedures
Section titled “Functions and Procedures”create_tag_facet
Section titled “create_tag_facet”Return type for search results
Signature:
function create_tag_facet ( p_tag_id in number) return varchar2;
Parameters:
Name | Direction | Type | Description |
---|---|---|---|
p_tag_id | in | number | - |
Returns: varchar2
create_tag_facet
Section titled “create_tag_facet”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:
Name | Direction | Type | Description |
---|---|---|---|
p_tag_id | in | number | ID of the tag |
Returns: varchar2
- Formatted facet string: “G#tag_id”
create_tag_value_facet
Section titled “create_tag_value_facet”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:
Name | Direction | Type | Description |
---|---|---|---|
p_tag_id | in | number | ID of the tag |
p_tag_value | in | varchar2 | Specific value to match for this tag |
Returns: varchar2
- Formatted facet string: “I#tag_id#tag_value”
combine_facets
Section titled “combine_facets”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:
Name | Direction | Type | Description |
---|---|---|---|
p_facets | in | apex_t_varchar2 | Array of individual facet strings |
Returns: varchar2
- Combined facet string with colon separators
search_documents
Section titled “search_documents”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:
Name | Direction | Type | Description |
---|---|---|---|
p_search_expression | in | varchar2 default null | Full-text search expression (optional) |
p_dyn_facets | in | varchar2 default null | Dynamic facets in format: “G#tag_id:I#tag_id#tag_value:…”. See combine_facets on how to build such a string. |
p_facet_and_match | in | varchar2 default 'N' | ’Y’ for AND matching (all tags), ‘N’ for OR matching (any tag) |
p_modified_after | in | timestamp with local time zone default null | Filter documents modified after this date (optional) |
Returns: t_search_results pipelined
- Pipelined table of search results
search_user_documents
Section titled “search_user_documents”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:
Name | Direction | Type | Description |
---|---|---|---|
p_username | in | varchar2 | Username to search documents for |
p_search_expression | in | varchar2 default null | Full-text search expression (optional) |
p_dyn_facets | in | varchar2 default null | Dynamic facets in format: “G#tag_id:I#tag_id#tag_value:…”. See combine_facets on how to build such a string. |
p_facet_and_match | in | varchar2 default 'N' | ’Y’ for AND matching (all tags), ‘N’ for OR matching (any tag) |
p_modified_after | in | timestamp with local time zone default null | Filter documents modified after this date (optional) |
Returns: t_search_results pipelined
- Pipelined table of search results