Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 43 additions & 0 deletions text/oracle-text-scripts/Db Crawler/demo_database.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- JDBC connection string looks like:
-- jdbc:oracle:thin:@localhost:1521:ses


alter user scott account unlock;
grant connect,resource to scott identified by tiger;
connect scott/tiger

create table my_table (
key varchar2(2000) primary key,
url varchar2(2000),
content varchar2(4000),
lastmodifieddate date,
lang varchar2(2000),
title varchar2(2000),
auth_list varchar2(2000)
);

-- remember, auth_list is our "Security Attributes" column

-- the first document is visible only to the user sesuser1nt

insert into my_table values ('doc1', 'doc1', 'the quick brown fox jumps over the lazy dog', sysdate, 'EN', 'Database Document One', 'sesuser1');

-- the second document is visible to anyone who has the "managers" role

insert into my_table values ('doc2', 'doc2', 'le renard brun rapide saute par-dessus le chien paresseux', sysdate, 'FR', 'Database Document Two', 'manager');

-- The following table represents the security informat
-- Each user can have a set of roles, plus his own username

create table user_role_map (
username varchar2(2000),
rolelist varchar2(2000)
);

insert into user_role_map values (
'sesuser1', 'sesuser1 superuser manager employee');
insert into user_role_map values (
'sesuser2', 'sesuser2 manager employee'
);

commit;
70 changes: 70 additions & 0 deletions text/oracle-text-scripts/Db Crawler/demo_database_two_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
-- JDBC connection string looks like:
-- jdbc:oracle:thin:@localhost:1521:ses


alter user scott account unlock;
grant connect,resource to scott identified by tiger;
connect scott/tiger

drop table my_table;

create table my_table (
key varchar2(2000) primary key,
url varchar2(2000),
content varchar2(4000),
lastmodifieddate date,
lang varchar2(2000),
title varchar2(2000),
auth_list varchar2(2000)
);

-- remember, auth_list is our "Security Attributes" column

-- the first document is visible only to the user sesuser1nt

insert into my_table values ('doc1', 'doc1', 'the quick brown fox jumps over the lazy dog', sysdate, 'EN', 'Database Document One', 'sesuser1');

-- the second document is visible to anyone who has the "managers" role

insert into my_table values ('doc2', 'doc2', 'le renard brun rapide saute par-dessus le chien paresseux', sysdate, 'FR', 'Database Document Two', 'manager');

drop table my_table2;

create table my_table2 (
key varchar2(2000) primary key,
url varchar2(2000),
content varchar2(4000),
lastmodifieddate date,
lang varchar2(2000),
title varchar2(2000),
auth_list varchar2(2000)
);

-- remember, auth_list is our "Security Attributes" column

-- the first document is visible only to the user sesuser1nt

insert into my_table values ('doc1_2', 'doc1_2', 'the quick brown fox jumps over the lazy dog', sysdate, 'EN', 'Database Document One', 'sesuser1 sesuser3');

-- the second document is visible to anyone who has the "managers" role

insert into my_table values ('doc2_2', 'doc2_2', 'le renard brun rapide saute par-dessus le chien paresseux', sysdate, 'FR', 'Database Document Two', 'manager foo');


-- The following table represents the security informat
-- Each user can have a set of roles, plus his own username

drop table user_role_map;

create table user_role_map (
username varchar2(2000),
rolelist varchar2(2000)
);

insert into user_role_map values (
'sesuser1', 'sesuser1 superuser manager employee');
insert into user_role_map values (
'sesuser2', 'sesuser2 manager employee'
);

commit;
45 changes: 45 additions & 0 deletions text/oracle-text-scripts/GermanCompound/decompound.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- this should be a test of german decompounding, but it doesn't seem to
-- work
-- Although when we index 'hauptbahnhof' we get tokens of type 9 for
-- haupt and bahnhof, we can't seem to search on them

drop table detext;

create table detext
( id number(4) not null
, name varchar2(30)
)
/

insert into detext values (1, 'Hauptbahnhof');

exec ctx_ddl.drop_preference('mylex')

begin
ctx_ddl.create_preference('mylex', 'BASIC_LEXER');
ctx_ddl.set_attribute ( 'mylex', 'index_stems', 'GERMAN');
ctx_ddl.set_attribute ( 'mylex', 'composite', 'GERMAN');
ctx_ddl.set_attribute ( 'mylex', 'alternate_spelling', 'GERMAN');
end;
/

exec ctx_ddl.drop_preference('myword')

begin
ctx_ddl.create_preference('myword', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('myword','FUZZY_MATCH','GERMAN');
end;
/

create index detext_idx1 on detext(name)
indextype is ctxsys.context
parameters ('WORDLIST myword DATASTORE ctxsys.default_datastore LEXER mylex SYNC (on commit)')
/

select token_text, token_type from dr$detext_idx1$i;

-- this doesn't work
SELECT id, name, score(1) as score FROM detext WHERE contains(name, '$bahnhof', 1) > 0;

-- but this does
SELECT id, name, score(1) as score FROM detext WHERE contains(name, '$haupt', 1) > 0;
36 changes: 36 additions & 0 deletions text/oracle-text-scripts/GermanCompound/german_names.sql~
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
drop table emp;

create table emp
( id number(4) not null
, name varchar2(30)
)
/


insert into emp values (1, 'Hauptbahnhof');

exec ctx_ddl.drop_preference('mylex')

begin
ctx_ddl.create_preference('mylex', 'BASIC_LEXER');
ctx_ddl.set_attribute ( 'mylex', 'index_stems', 'GERMAN');
ctx_ddl.set_attribute ( 'mylex', 'composite', 'GERMAN');
ctx_ddl.set_attribute ( 'mylex', 'alternate_spelling', 'GERMAN');
end;
/

exec ctx_ddl.drop_preference('myword')

begin
ctx_ddl.create_preference('myword', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('myword','FUZZY_MATCH','GERMAN');
end;
/

create index emp_idx1 on emp(name)
indextype is ctxsys.context
parameters ('WORDLIST myword DATASTORE ctxsys.default_datastore LEXER mylex STOPLIST ctxsys.empty_stoplist SYNC (on commit)')
/

-- The ? indicates fuzzy matching
SELECT id, name, score(1) as score FROM emp WHERE contains(name, 'strasse', 1) > 0;
36 changes: 36 additions & 0 deletions text/oracle-text-scripts/KWIC_html_test/Create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
create user testuser identified by testuser default tablespace users temporary tablespace temp;

grant connect, resource, ctxapp to testuser;

connect testuser/testuser

create table EmailArchive (
PK NUMBER,
FOLDER VARCHAR2(255),
SUBJECT VARCHAR2(255),
MAILDATE DATE,
MAILTO VARCHAR2(255),
MAILFROM VARCHAR2(255),
MAILCC VARCHAR2(255),
TEXT CLOB);

insert into emailarchive values (1, 'INBOX', 'The QB Fox', '10-JUL-2002','john.smith@oracle.com', 'roger.ford@oracle.com', null,
'The quick brown fox jumps over the lazy dog.
The lazy dog was surprised to see a quick brown
fox jumping over it, and thought to itself "goodness,
that looked like a wolf - or at least a brown fox -
jumping over me".');

insert into emailarchive values (1, 'INBOX', 'Now is the time...', '11-JUL-2002','roger.ford@oracle.com', 'john.smith@oracle.com', null,
'Now is the time for all good men to come to the aid of the party.
The party is not doing very well at the moment as it has run out of
drink, and most of the guests have gone home. What we need is
for someone to come along with more drink, and hopefully with a
quick brown fox as a companion.
');

commit;

create index email_text on emailarchive(text)
indextype is ctxsys.context;

Loading