Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Be responsible for your future
Enter the USA legally!

Visa, Green Card, Citizenship, Passport
Consultation Services








Oracle » PL-SQL » Context » Full Text Searc

Using the Context cartridge

     



Managing Context is an arduous task. The best approach is to use the
command line utility as much as possible. Below is a code sample which creates
a policy (a policy is a construct which informs context which column on
what table to scan during a search operation). The next example illustrates how
to perform a search, and stored the result keys in a table.


/* create a policy, on the emp_resume table */

ctx_svc.clear_all_errors;

dbms_output.put_line('Creating Policy ...');

ctx_ddl.create_policy(
POLICY_NAME => 'EMP_RES_POLICY',
COLSPEC => 'EMP_RES.RESUME',
SOURCE_POLICY => 'CTXSYS.DEFAULT_POLICY',
DESCRIPTION => 'EMP Policy',
TEXTKEY => 'EMP_ID',
DSTORE_PREF => 'CTXSYS.DEFAULT_DIRECT_DATASTORE',
FILTER_PREF => 'CTXSYS.HTML_FILTER',
LEXER_PREF => 'CTXSYS.DEFAULT_LEXER'
);

dbms_output.put_line('Indexing Policy ...');

ctx_ddl.create_index('EMP_POLICY');


/* Run a Context query, place the result key values in a table */

/* first, this table needs to be created */

CREATE TABLE EMP_CTX_RESULTS(
TEXTKEY VARCHAR2(64),
TEXTKEY2 VARCHAR2(64),
SCORE NUMBER,
CONID NUMBER );

/* this code can go in a stored proc */

POLICY1 := 'EMP_POLICY';
TABLE1 := 'EMP_CTX_RESULTS';
ID1 := 100 ;
QUERY1 := 'COBOL|FORTRAN';

CTX_QUERY.CONTAINS(POLICY1, QUERY1, TABLE1, 1, ID1);

/* the table will contain records with a CONID of 100 */
/* ... you can use ampersand or pipe as the conditional */










Oracle : Related Topics


Sybase Web Site
Sybase iAnywhere Mobile Web Site
Oracle Enterprise Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2019 Stoltenbar Inc All Rights Reserved.