| Oracle Text Reference Release 9.0.1 Part Number A90121-01 |
|
CTX_QUERY Package , 2 of 7
This procedure enables you to browse words in an Oracle Text index. You specify a seed word and BROWSE_WORDS returns the words around it in the index, and a rough count of the number of documents that contain each word.
This feature is useful for refining queries. You can identify the following:
ctx_query.browse_words(index_name IN VARCHAR2, seed IN VARCHAR2, restab IN VARCHAR2, browse_id IN NUMBER DEFAULT 0, numwords IN NUMBER DEFAULT 10, direction IN VARCHAR2 DEFAULT BROWSE_AROUND, part_name IN VARCHAR2 DEFAULT NULL);
ctx_query.browse_words(index_name IN VARCHAR2, seed IN VARCHAR2, resarr IN OUT BROWSE_TAB, numwords IN NUMBER DEFAULT 10, direction IN VARCHAR2 DEFAULT BROWSE_AROUND, part_name IN VARCHAR2 DEFAULT NULL);
Specify the name of the index. You can specify schema.name. Must be a local index.
Specify the seed word. This word is lexed before browse expansion. The word need not exist in the token table. seed must be a single word. Using multiple words as the seed will result in an error.
Specify the name of the result table. You can enter restab as schema.name. The table must exist before you call this procedure, and you must have INSERT permissions on the table. This table must have the following schema.
| Column | Datatype |
|---|---|
|
browse_id |
number |
|
word |
varchar2(64) |
|
doc_count |
number |
Existing rows in restab are not deleted before BROWSE_WORDS is called.
Specify the name of the result array. resarr is of type ctx_query.browse_tab.
type browse_rec is record ( word varchar2(64), doc_count number ); type browse_tab is table of browse_rec index by binary_integer;
Specify a numeric identifier between 0 and 232. The rows produced for this browse have a value of in the browse_id column in restab. When you do not specify browse_id, it defaults to 0.
Specify the number of words returned.
Specify the direction for the browse. You can specify one of:
Symbols CTX_QUERY.BROWSE_BEFORE, CTX_QUERY.BROWSE_AROUND, and CTX_QUERY.BROWSE_AFTER are defined for these literal values as well.
Specify the name of the index partition to browse.
begin ctx_query.browse_words('myindex','dog','myres',numwords=>5,direction=>'AROUND'); end; select word, doc_count from myres order by word; WORD DOC_COUNT -------- ---------- CZAR 15 DARLING 5 DOC 73 DUNK 100 EAR 3
set serveroutput on; declare resarr ctx_query.browse_tab; begin ctx_query.browse_words('myindex','dog',resarr,5,CTX_QUERY.BROWSE_AROUND); for i in 1..resarr.count loop dbms_output.put_line(resarr(i).word || ':' || resarr(i).doc_count); end loop; end;
|
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|