Oracle8i interMedia Text Reference
Release 2 (8.1.6)

Part Number A77063-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

CTX_QUERY Package , 2 of 7


BROWSE_WORDS

This procedure enables you to browse words in an interMedia 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:

Syntax 1: To Store Results in Table

ctx_query.browse_word( 
  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 
); 

Syntax 2: To Store Results in Memory

ctx_query.browse_word( 
  index_name  in      varchar2, 
  seed        in      varchar2, 
  resarr      in out  browse_tab, 
  numwords    in      number   default 10, 
  direction   in      varchar2 default BROWSE_AROUND 
); 

index

Specify the name of the index. You can specify schema.name. Must be a local index.

seed

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.

restab

Specify the name of the result table. You can enter restab as schema.name. 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.

resarr

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;
browse_id

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.

numwords

Specify the length of the produced list in number of words. Specify a number between 1 and 1000.

direction

Specify the direction for the browse. You can specify one of:

value  behavior 

BEFORE 

Browse seed word and words alphabetically before the seed. 

AROUND 

Browse seed word and words alphabetically before and after the seed. 

AFTER 

Browse seed word and words alphabetically after the seed. 

Symbols CTX_QUERY.BROWSE_BEFORE, CTX_QUERY.BROWSE_AROUND, and CTX_QUERY.BROWSE_AFTER are defined for these literal values as well.

Example

Browsing Words with Result Table

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

Browsing Words with Result Array

declare
  resarr ctx_query.browse_tab;
begin
ctx_query.browse_words('myindex','dog',resarr,5,CTX_QUERY.AROUND);
for i in 1..resarr.count loop
  dbms_output.put_line(resarr(i).word || ':' || resarr(i).doc_count);
end loop;
end;

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index