sage computing servicessagecomputing.com.au/papers_presentations/oracletextinapex.pdf ·...

156
SAGE Computing Services Customised Oracle Training Workshops and Consulting Oracle Text in Apex Advanced Indexing Techniques Integrated with Application Express Scott Wesley Systems Consultant & Trainer

Upload: others

Post on 03-Jun-2020

28 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

SAGE Computing Services

Customised Oracle Training Workshops and Consulting

Oracle Text in Apex

Advanced Indexing Techniques Integrated with

Application Express

Scott Wesley

Systems Consultant & Trainer

Page 2: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Agenda

• Introduction

• Architecture

• Fundamentals

• Considerations

• Setting Up

• Samples

• Index Maintenance

• Visualisation

• New Features

Page 3: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Larry Lessig?

Page 4: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

the law is strangling creativity

http://www.ted.com/talks/larry_lessig_says_the_law_is_strangling_creativity.html

http://presentationzen.blogs.com/presentationzen/2005/10/the_lessig_meth.html

Page 5: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Identity 2.0 – Dick Hardt

http://identity20.com/media/OSCON2005/

Page 6: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

who’s the Dick on your site

Page 7: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Connor McDonald

http://www.oracledba.co.uk

Page 8: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

so today’s going to be more like this

Page 9: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

and this

Page 10: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

after I show a few pictures

Page 11: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

who_am_i;

Page 13: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 14: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 15: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

balance

Page 16: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 17: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 18: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 19: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 20: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 21: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 22: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 23: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Why use Oracle Application Express?

Page 24: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Why use Oracle Text?

Page 25: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 26: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

What is Oracle Text?

Page 27: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Document Collection

Page 28: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 29: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Catalogue Information

Page 30: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 31: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Document Classification

Page 32: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 33: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Architecture

Page 34: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Class Description

Datastore How are your documents stored?

Filter How can the documents be converted to plain text?

Lexer What language is being indexed?

Wordlist How should stem and fuzzy queries be expanded?

Storage How should the index data be stored?

Stop List What words or themes are not to be indexed?

Section Group How are documents sections defined?

Page 35: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

1) Example

Page 36: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

CREATE INDEX ctx_name ON my_names(name)

INDEXTYPE IS ctxsys.context

PARAMETERS ('DATASTORE CTXSYS.DEFAULT_DATASTORE');

Page 37: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

SQL> SELECT SCORE(1), name

2 FROM my_names

3 WHERE CONTAINS(name, 'fuzzy(john,,,weight)', 1) > 0

4 ORDER BY SCORE(1) DESC;

SCORE(1) NAME

---------- ----------------------------------------

100 John

100 John

70 Jon

70 Jon

63 Joan

63 Joan

52 Jong

48 Jona

8 rows selected.

Page 38: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

2) Datastore

Page 39: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

CTXSYS.DEFAULT_DATASTORE

Page 40: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

BLOB

Page 41: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

BFiles

Page 42: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Pointers to objects on file system

Page 43: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

URLs

Page 44: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Pointers to objects on the intertube

Page 45: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

User Defined

Page 46: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Why would you?

Page 47: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

3) Index Type

Page 48: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

a) CONTEXT

Page 49: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Document Collection

Page 50: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

large document size

Page 51: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

provides a score

Page 52: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

asynchronous index & table data

Page 53: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 54: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

CONTAINS

Page 55: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

b) CTXCAT

Page 56: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Catalogue Information

Page 57: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

smaller documents

Page 58: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

text fragments

Page 59: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

multiple attributes

Page 60: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

set lists

Page 61: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

similar to typical index paradigm

Page 62: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

transactional

Page 63: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 64: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

CATSEARCH

Page 65: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

c) CTXRULE

Page 66: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Document Classification

Page 67: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

routing information

Page 68: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

displace manual interaction

Page 69: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

not binary files

Page 70: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

MATCHES

Page 71: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

4) Considerations

Page 72: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

location of text

Page 73: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

document format

Page 74: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

bypassing rows - images

Page 75: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

character set

Page 76: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

language

Page 77: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

fuzzy matching & stemming

Page 78: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

wildcard query performance

Page 79: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 80: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

stopwords & stopthemes

Page 81: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

query performance and storage of LOBs

Page 82: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

mixed queries

Page 83: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

5) Setting up

Page 84: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

GRANT ctxapp TO ausoug;

Page 85: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

create & delete indexing preferences

Page 86: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

use Oracle Text PL/SQL supplied packages

Page 87: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

1* select grantee, owner, table_name, privilege from dba_tab_privs where table_name =

'CTX_DDL'

SQL> /

GRANTEE OWNER TABLE_NAME PRIVILEGE

-------------------- ------------ ------------------------------ --------------------

CTXAPP CTXSYS CTX_DDL EXECUTE

APEX_040000 CTXSYS CTX_DDL EXECUTE

APEX_030200 CTXSYS CTX_DDL EXECUTE

AUSOUG CTXSYS CTX_DDL EXECUTE

XDB CTXSYS CTX_DDL EXECUTE

5 rows selected.

Page 88: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

PLS-00201: identifier "string" must be declared

Page 89: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

CTX PL/SQL Packages

GRANT EXECUTE ON CTXSYS.CTX_CLS TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_DDL TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_DOC TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_OUTPUT TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_QUERY TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_REPORT TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_THES TO ausoug;

GRANT EXECUTE ON CTXSYS.CTX_ULEXER TO ausoug;

Page 90: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Using URL Datastore in 11g

CREATE ROLE apex_url_datastore_role;

GRANT apex_url_datastore_role TO APEX_040000

WITH ADMIN OPTION;

GRANT apex_url_datastore_role TO ausoug;

EXEC

ctxsys.ctx_adm.set_parameter

('file_access_role'

,'APEX_URL_DATASTORE_ROLE');

Page 91: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Demonstrations

Script Description

Ctx_blobs.sql Import & index a range of documents

Ctx_bfiles.sql Import & index BFILE pointers

Ctx_urls.sql Index & search URL references

Ctx_dict.sql Index & search English dictionary words

Ctx_views.sql Index view SQL text for impact analysis

Ctx_apex_files.sql Duplicate and search Apex file repository

Ctx_apex_backups.sql Hunt through your (automated) Apex app backups

Ctx_names.sql Basic name filter options

Ctx_products.sql Multiple column searches

Ctx_category.sql Attribute based searching

Ctx_classify.sql Classify documents into categories

Page 92: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 93: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 94: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 95: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 96: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 97: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 98: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 99: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 100: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 101: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 102: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 103: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 104: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 105: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 106: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 107: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 108: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 109: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 110: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 111: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 112: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

6) Index maintenance

Page 113: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

indexing errors

Page 114: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 115: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

resume failed index

Page 116: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

ALTER INDEX ctx_surname

REBUILD PARAMETERS ('resume memory 10m');

Page 117: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

recreate index online (11g)

Page 118: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

EXEC ctx_ddl.recreate_index_online

('ctx_surname', 'replace lexer sw_lexer');

Page 119: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

rebuilding an index

Page 120: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

ALTER INDEX ctx_surname

REBUILD PARAMETERS('replace lexer sw_lexer')

ONLINE;

Page 121: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

ctx_report.index_stats

Page 122: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

create table ausoug.my_stats (stats clob);

declare

x clob := null;

begin

for r_rec in

(select *

from ctxsys.ctx_indexes

where idx_owner = 'AUSOUG'

and idx_type = 'CONTEXT') loop

ctx_report.index_stats(r_rec.idx_name,x);

insert into ausoug.my_stats values (x);

end loop;

commit;

dbms_lob.freetemporary(x);

end;

/

Page 123: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

7) Data Dictionary

Page 124: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 125: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 126: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 127: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 128: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

SQL> select count(*)

2 from all_views

3 where owner = 'CTXSYS';

COUNT(*)

----------

58

Page 129: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

8) Common Questions

Page 130: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

DML operations on a CONTEXT index

Page 131: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

ctxsys.ctx_user_pending

Page 132: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

synchronise the index

synchronize

Page 133: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

EXEC ctx_ddl.sync_index('ctx_surname');

Page 134: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

dbms_job

Page 135: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

dbms_scheduler

Page 136: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

how often?

Page 137: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 138: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

optimise the index

Page 139: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

can get fragmented

Page 140: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

inverted index

Page 141: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

each entry contains list of documents

Page 142: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

DOG - DOC1 DOC3 DOC5

DOG - DOC7

DOG - DOC9

DOG - DOC11

Page 143: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

ctx_ddl.optimize_index

Page 144: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

capacity planning?

Page 145: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

Object of Interest Num

Rows

Table

Size

Index

size

Dictionary 150k 7 27

Documents 28 34 1.5

Names 27k 1 6

Views 2k 7 2

BFiles 4

Product 1

URL 1

Page 146: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

more text

Page 147: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

cleaner data

Page 148: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

less overhead

Page 149: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

document format

Page 150: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 151: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

next steps?

Page 152: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

read Application Developer’s Guide

Page 153: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search
Page 154: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

find examples

Page 155: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

experiment

Page 156: SAGE Computing Servicessagecomputing.com.au/papers_presentations/OracleTextInApex.pdf · Ctx_views.sql Index view SQL text for impact analysis Ctx_apex_files.sql Duplicate and search

SAGE Computing Services

Customised Oracle Training Workshops and Consulting

Question time

Presentations are available from our website:

http://www.sagecomputing.com.au

[email protected]

[email protected]

http://triangle-circle-square.blogspot.com