471,073 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Indexing multiple fields with Oracle TEXT (Intermedia)

What's wrong with my sample ?

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

connect ctxsys/ctxsys1

create table tmp_objects as select * from sys.dba_objects;
SQL> select count(*) from tmp_objects;

COUNT(*)
----------
28705

create or replace procedure idx_fields_as_one_clob(
p_id in rowid,
p_lob IN OUT clob
)
is
nb_fields number := 12;
begin
for c1 in (select * from tmp_objects where rowid = p_id)
loop
-- assemble into p_lob ANY data you want
-- indexed.
dbms_lob.writeappend( p_lob, length(c1.OWNER)
+length(c1.OBJECT_NAME)
+length(c1.SUBOBJECT_NAME)
+length(c1.OBJECT_ID)
+length(c1.DATA_OBJECT_ID)
+length(c1.OBJECT_TYPE)
+length(TO_CHAR(c1.CREATED,'YYYYMMDD'))
+length(TO_CHAR(c1.LAST_DDL_TIME,'YYYYMMDD'))
+length(c1.TIMESTAMP)
+length(c1.STATUS)
+length(c1.TEMPORARY)
+length(c1.GENERATED)
+length(c1.SECONDARY)
+ nb_fields,
c1.OWNER || ' ' ||
c1.OBJECT_NAME || ' ' ||
c1.SUBOBJECT_NAME || ' ' ||
c1.OBJECT_ID || ' ' ||
c1.DATA_OBJECT_ID || ' ' ||
c1.OBJECT_TYPE || ' ' ||
TO_CHAR(c1.CREATED,'YYYYMMDD') || ' ' ||
TO_CHAR(c1.LAST_DDL_TIME,'YYYYMMDD') || ' ' ||
c1.TIMESTAMP || ' ' ||
c1.STATUS || ' ' ||
c1.TEMPORARY || ' ' ||
c1.GENERATED || ' ' ||
c1.SECONDARY
);
end loop;
end;
/

alter table tmp_objects add dummy_col varchar2(1);

begin
-- ctx_ddl.drop_preference('tmp_user_datastore');
ctx_ddl.create_preference( 'tmp_user_datastore', 'user_datastore'
);
ctx_ddl.set_attribute( 'tmp_user_datastore', 'procedure',
'idx_fields_as_one_clob' );
end;
/

begin
-- ctx_ddl.drop_preference('my_lexer');
ctx_ddl.create_preference( 'my_lexer', 'BASIC_LEXER' );
ctx_ddl.set_attribute( 'my_lexer', 'base_letter', 'YES');
ctx_ddl.set_attribute( 'my_lexer', 'mixed_case', 'YES' );
end;
/

drop index foo2_idx;
create index foo2_idx on tmp_objects(dummy_col) indextype is
ctxsys.context parameters( 'datastore tmp_user_datastore lexer
my_lexer');

select * from tmp_objects where contains( dummy_col, 'JAVA', 1 ) > 0 ;
SQL> No rows selected

Thank's for your help !
Jul 19 '05 #1
1 2884
I don't see anything wrong with your procedure, but remember that when
you create the index, it does not instantaneously contain entries for
all existing data. The CTXSYS system indexes content on a separate
process, and sometimes it can take a while. This assumes that the row
with the 'JAVA' word was pre-existing. If you add it later, you need
to synch the index.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by susmita_ganguly | last post: by
108 posts views Thread by Bryan Olson | last post: by
3 posts views Thread by vonclausowitz | last post: by
reply views Thread by Frank | last post: by
1 post views Thread by Server Applications | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.