Monday, September 5, 2016

Oracle full text search

Currently we use Compass indexes to speed up the full text search, I am not the fun of this solution.
There is a plan to migrate some functionality and I tried what Oracle Text is.


search

First I was surprised, to start with this feature you need only a few things:


  1. create a  TEXT index
  2. run your select to search

create index I_CONTENT_RAW_TEXT on T_CONTENT(RAW_TEXT_CLOB) indextype is ctxsys.context;

SELECT * FROM T_DOLA_CONTENT T 
WHERE CONTAINS(T.RAW_TEXT_CLOB, '%gäller%') >0

Fantastic!
You have to maintain your index of course:

  • update index
    you can run a little script in a DBMS_JOB: 

  CTX_DDL.SYNC_INDEX('I_CONTENT_RAW_TEXT', -- your index name here
                         '100M', -- memory count
                           NULL, -- param for partitioned idxes
                             2 -- parallel count
                               );
          • rebuild index
            CTX_DDL.OPTIMIZE_INDEX('I_CONTENT_RAW_TEXT', 'REBUILD');

          questions:


          • like search? it is working with the %
          • html encoded characters
          • the search is non-case-sensitive
          • special characters
          • glyphs