Context Indexes and ignoring characters

So, we're trying to get a text index to ignore apostrophe's.
insert into table values ('Arby''s');We want the above entry to be located with either of the following queries:
select *
from table
where contains(field, 'Arbys')>0and also
select *
from table
where contains(field, 'Arby''s')>0The second SQL works already, it's the former search that is finding no records. I tried adding an apostrophe to the STOPLIST, but it didn't seem to make a difference. Is there another tweak I can make, so that this works? Or am I going to need to create 2 columns, one without special characters which actually has the context index on it?
Thanks,
--=Chuck

So this is what I've setup:
SQL> begin
  2 
  3   
  4 
  5    CTX_DDL.CREATE_STOPLIST(stoplist_name => 'TEST_APOSTROPHE',
  6                            stoplist_type => 'BASIC_STOPLIST');
  7 
  8    CTX_DDL.ADD_STOPWORD(stoplist_name => 'TEST_APOSTROPHE',
  9                         stopword      => ''''); 
10                    
11 
12  end;
13  /
PL/SQL procedure successfully completed.
SQL> create table test_apos (name varchar2(100));
Table created.
SQL> CREATE INDEX TEST_APOS_NAME_CTX ON TEST_APOS
  2  (NAME)
  3  INDEXTYPE IS CTXSYS.CONTEXT
  4  PARAMETERS('STOPLIST TEST_APOSTROPHE SYNC(ON COMMIT)');
Index created.
SQL> insert into test_apos values ('Arby''s');
1 row created.
SQL> commit;
Commit complete.The following usages of CONTAINS( ) will find the record, but, they either explicitly mention the apostrophe, or, they look for the string prior to the apostrophe. I expect all of these to work regardless of the STOPLIST entry:
SQL> select * from test_apos where contains (name, 'Arby') > 0;
NAME
Arby's
SQL>  select * from test_apos where contains (name, 'Arby%') > 0;
NAME
Arby's
SQL> select * from test_apos where contains (name, 'Arby''s') > 0;
NAME
Arby's
SQL> select * from test_apos where contains (name, '$(Arby)') > 0;
NAME
Arby'sNone of the following work (incl your suggestion, which I greatly appreciate, btw):
SQL> select * from test_apos where contains (name, 'Arbys') > 0;
no rows selected
SQL> select * from test_apos where contains (name, 'Arby%s') > 0;
no rows selected
SQL> select * from test_apos where contains (name, 'Arbys%') > 0;
no rows selected
SQL> select * from test_apos where contains (name, '$(Arbys)') > 0;
no rows selected--=cf

Similar Messages

  • Trying to understand context indexes and contains-help

    Hi
    i am using
    Achieving functionality of many preferences using one context index
    to understand context indexes and contains
    and i get the following
    Error starting at line 1 in command:
    begin
    ctx_ddl.create_preference ('nd_mcds', 'multi_column_datastore');
    ctx_ddl.set_attribute ('nd_mcds', 'columns', 'text nd, text text');
    ctx_ddl.create_section_group ('nd_sg', 'basic_section_group');
    ctx_ddl.add_ndata_section ('nd_sg', 'nd', 'nd');
    ctx_ddl.create_preference ('test_lex', 'basic_lexer');
    ctx_ddl.set_attribute ('test_lex', 'whitespace', '/\|-_+');
    end;
    Error report:
    ORA-06550: line 5, column 15:
    PLS-00302: component 'ADD_NDATA_SECTION' must be declared
    ORA-06550: line 5, column 7:
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    so i am using the following to check for the error
    http://docs.oracle.com/cd/E18283_01/text.112/e16593/cddlpkg.htm#BABCBFCB
    plus
    oracle text application developer's guide
    plus
    oracle text reference
    but these have not listed that error (i have even googled this in vain)
    background::we were actually using catsearch but because of its downsides i want to implement this
    Is Achieving functionality of many preferences using one context index a good place to start when one does not know about
    context and contains??
    please post any other useful link for contains and context index that even explains
    1) fuzzy
    2) stem
    3) synonym
    4) near
    5) soundex
    6)ndata
    7)lexer
    thanks in advance

    Ndata is new to Oracle 11g. Your other posts indicate that you are using Oracle 10g, so you don't have ndata, so you get an error when you try to use it. If you want to use the 11g features that enable context indexes with contains to do all of the things that ctxcat indexes with catsearch do, then you need to upgrade to 11g.
    The online documentation is searchable. Most things regarding Oracle Text are contained in either the Oracle Text Reference or the Oracle Text Application Developer's guide.
    I suggest that you start with something very simple, then build from there.
    The following is similar to your other post that used catsearch:
    SCOTT@orcl_11gR2> CREATE TABLE mv_cat_seg_reg_prod
      2    (cat_ids       VARCHAR2 ( 7),
      3       act_status    VARCHAR2 (10),
      4       name           VARCHAR2 ( 1),
      5       email           VARCHAR2 ( 1),
      6       address1      VARCHAR2 ( 1),
      7       address2      VARCHAR2 ( 1),
      8       contact_name  VARCHAR2 ( 1),
      9       mobile           VARCHAR2 ( 1),
    10       telephone     VARCHAR2 ( 1))
    11  /
    Table created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO mv_cat_seg_reg_prod VALUES
      3    ('1', 'Y', 'A', 'B', 'C', 'D', 'E', 'F', 'G')
      4  INTO mv_cat_seg_reg_prod VALUES
      5    ('2', 'N', 'H', 'I', 'J', 'K', 'L', 'M', 'N')
      6  SELECT * FROM DUAL
      7  /
    2 rows created.
    SCOTT@orcl_11gR2> CREATE INDEX mv_cat_seg_reg_prod_idx
      2  ON mv_cat_seg_reg_prod (cat_ids)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  /
    Index created.
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$mv_cat_seg_reg_prod_idx$i
      2  /
    TOKEN_TEXT
    1
    2
    2 rows selected.
    SCOTT@orcl_11gR2> SELECT *
      2  FROM   (SELECT SCORE (1), name, email, address1, address2, contact_name, mobile, telephone
      3            FROM   mv_cat_seg_reg_prod
      4            WHERE  CONTAINS (cat_ids, '1', 1) > 0
      5            AND    act_status = 'Y'
      6            ORDER  BY DBMS_RANDOM.VALUE)
      7  WHERE  ROWNUM < 8
      8  /
      SCORE(1) N E A A C M T
             4 A B C D E F G
    1 row selected.

  • Context index and contains operator syntax how it works ?

    Hi
    I create a context index on four collumns (text_prof, text_gest, text_citizen, text)
    of the same table content.
    When i have more than one collumn being queryed using the contains syntax, oracle display the ora 29907 error saying found duplicated labels in primary invocations .
    This query works:
    SELECT * FROM content WHERE cod_type = '1'
    AND (UPPER(title) LIKE UPPER('%tabagismo%')
    OR contains (text, 'tabagismo',1)>0
    This not works:
    SELECT * FROM content
    WHERE cod_type = '1' AND (
    UPPER(title) LIKE UPPER('%tabagismo%')
    OR contains (text, 'tabagismo',1)>0
    OR contains (text_citizen,'tabagismo',1)>0
    OR contains (text_gest,'tabagismo',1)>0
    OR contains (text_prof,'tabagismo',1)>0
    How can i fix it ?
    I need to query all these colluns !
    Does the contains operator can be used only in one collumn?
    Thank´s in advance

    Hi
    I create a context index on four collumns (text_prof, text_gest, text_citizen, text)
    of the same table content.
    When i have more than one collumn being queryed using the contains syntax, oracle display the ora 29907 error saying found duplicated labels in primary invocations .
    This query works:
    SELECT * FROM content WHERE cod_type = '1'
    AND (UPPER(title) LIKE UPPER('%tabagismo%')
    OR contains (text, 'tabagismo',1)>0
    This not works:
    SELECT * FROM content
    WHERE cod_type = '1' AND (
    UPPER(title) LIKE UPPER('%tabagismo%')
    OR contains (text, 'tabagismo',1)>0
    OR contains (text_citizen,'tabagismo',1)>0
    OR contains (text_gest,'tabagismo',1)>0
    OR contains (text_prof,'tabagismo',1)>0
    How can i fix it ?
    I need to query all these colluns !
    Does the contains operator can be used only in one collumn?
    Thank´s in advance

  • Context Index and performance

    Hi,
    I want to create a context index on one column which contains large text. And the table contains millions of records and daily inserts happen into the same table. My question is
    1.Do we need to run any procedures after inserting the records daily?
    2.Is there any problem from performace point of view creating context index on the table
    Thanks,
    Sri

    sri333 wrote:
    Hi,
    I want to create a context index on one column which contains large text. And the table contains millions of records and daily inserts happen into the same table. My question is
    1.Do we need to run any procedures after inserting the records daily?Not for what you describe. But you didn't describe much. I guess you will do something with this table data later. It depends from that. But since you only mentioned that you insert. Then no there is nothing to do after that.
    2.Is there any problem from performace point of view creating context index on the tableSure. Creating the index takes time. If the index is there new inserts will take more time.
    Edited by: Sven W. on Oct 10, 2012 12:02 PM

  • Context indexing and PDFs

    I recently used application express to create an upload system to house word docs, Excel files and PDFs in a BLOB. I used a context index to index them and a CONTAINS query to search through the BLOB and have it find which documents contained certain words.
    My Problem is some PDFs are not indexing correctly, and I wondered what limitations there were to this and if we could fix them. Has anyone else encountered this?

    I am logged in as the user who owns the index.
    I set a filter "token_text = 'oracle' " when I am viewing the data in the DR$TEMP_INDEX$I table and I don't get anything returned(oracle is obviously listed in the 10g product guide, but it isn't in anything else). It returns other keywords in other documents.
    I am thinking it may be the embedded fonts issue? thets the only difference in the files I can see.
    Message was edited by:
    in3d

  • Substring search with Oracle context indexes

    Hi,
    i would like to know if it is possibile to do a substring search with one of the obtion offer with the context indexes.
    (ctxcat,ctxrule,context)
    example:
    i would like to search the word 'berub' in a column A in table_example.
    the value in the column a are :
    The betther
    berube
    A.berube
    berub
    Berub
    BERUB
    R berube
    S tartif
    Y Thibeault
    the rows return should be :
    berube
    A.berube
    berub
    Berub
    BERUB
    R berube
    A simple sql could be
    select * from table_example where upper(a) like upper('%berub%' );
    How i can do this same action with the context indexes and a select (catsearch, contains, matches), if it is possible?
    A example will be welcome
    Thanks

    I know how to do explain plan.
    my point is not the query i post, it's just a example.
    I have many query on my production we optimize many times (they past from 3min to 15 sec with optimisation, but we want to have better result). At this point we are looking to implant the context indexes to make them more efficient.
    Do make this sql more efficient we have to deal with like '%xxxxxx%' and the context indexes like to be a option, but we have to be able to do some substring search with context option.
    Is it possible to do it and how?
    This is my question and why i post it here. The query is just a simple example to illsutrate what i want.
    Thanks to anyone who can answer my question.

  • Optimizing context index

    I have created a context index and want to optimize it regularly. I issue the following statement:
    ctx_ddl.optimize_index('MY_INDEX','FAST');
    In the Enterprise Manager I can see, that there are a lot of Sort/Merge-operations, but the optimize process doesn't finish.
    (During optimize there are inserts into the table and the index is updated by the ctx_ddl.sync_index procedure).
    Can anyone tell me why the optimize doesn't finish? How can I avoid this situation?

    How long did you leave it running?Optimizing ran more than 10 hours. So I cancelled it, because this is not acceptable.
    Optimization is an intensive process, and can sometimes take longer than the original index creation.
    If you want it to complete in less time, consider using FULL optimize, but setting a time limit on it. That way it will do as much as it can within the time limit, and then start again next time from where it finished last time.During the night, I start a FULL optimize with MAXTIME = 60 minutes. But this seems not to be enough. If I don't start FAST optimizing during the day, the index get to much fragmentated.
    Alternatively, if optimization is taking a lot longer than creating the index, consider dropping the index and recreating it from scratch. This will require downtime on the system, unless you get clever and use the USER_DATASTORE to create two indexes on different, dummy, columns - and switch searching between them when you want to rebuild the index. Make sure you use a generous setting for INDEX_MEMORY to avoid fragmentation.
    - Roger

  • Creating a single context index on a one-to-many and lookup table

    Hello,
    I've been successfully setting up text indexes on multiple columns on the same table (using MULTI_COLUMN_DATASTORE preferences), but now I have a situation with a one-to-many data collection table (with a FK to a lookup table), and I need to search columns across both of these tables. Sample code below, more of my chattering after the code block:
    CREATE TABLE SUBMISSION
    ( SUBMISSION_ID             NUMBER(10)          NOT NULL,
      SUBMISSION_NAME           VARCHAR2(100)       NOT NULL
    CREATE TABLE ADVISOR_TYPE
    ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_NAME         VARCHAR2(50)        NOT NULL
    CREATE TABLE SUBMISSION_ADVISORS
    ( SUBMISSION_ADVISORS_ID    NUMBER(10)          NOT NULL,
      SUBMISSION_ID             NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      FIRST_NAME                VARCHAR(50)         NULL,
      LAST_NAME                 VARCHAR(50)         NULL,
      SUFFIX                    VARCHAR(20)         NULL
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (1, 'Some Research Paper');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (2, 'Thesis on 17th Century Weather Patterns');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (3, 'Statistical Analysis on Sunny Days in March');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (1, 'Department Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (2, 'Department Co-Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (3, 'Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (4, 'Associate Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (5, 'Scientist');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (1,1,2,'John', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (2,1,2,'Jane', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (3,2,3,'Johan', 'Smith', NULL);
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (4,2,4,'Magnus', 'Jackson', 'MS');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (5,3,5,'Williard', 'Forsberg', 'AMS');
    COMMIT;I want to be able to create a text index to lump these fields together:
    SUBMISSION_ADVISORS.FIRST_NAME
    SUBMISSION_ADVISORS.LAST_NAME
    SUBMISSION_ADVISORS.SUFFIX
    ADVISOR_TYPE.ADVISOR_TYPE_NAME
    I've looked at DETAIL_DATASTORE and USER_DATASTORE, but the examples in Oracle Docs for DETAIL_DATASTORE leave me a little bit perplexed. It seems like this should be pretty straightforward.
    Ideally, I'm trying to avoid creating new columns, and keeping the trigger adjustments to a minimum. But I'm open to any and all suggestions. Thanks for for your time and thoughts.
    -Jamie

    I would create a procedure that creates a virtual document with tags, which is what the multi_column_datatstore does behind the scenes. Then I would use that procedure in a user_datastore, so the result is the same for multiple tables as what a multi_column_datastore does for one table. I would also use either auto_section_group or some other type of section group, so that you can search using WITHIN as with the multi_column_datastore. Please see the demonstration below.
    SCOTT@orcl_11gR2> -- tables and data that you provided:
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION
      2  ( SUBMISSION_ID           NUMBER(10)          NOT NULL,
      3    SUBMISSION_NAME           VARCHAR2(100)          NOT NULL
      4  )
      5  /
    Table created.
    SCOTT@orcl_11gR2> CREATE TABLE ADVISOR_TYPE
      2  ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      3    ADVISOR_TYPE_NAME      VARCHAR2(50)          NOT NULL
      4  )
      5  /
    Table created.
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION_ADVISORS
      2  ( SUBMISSION_ADVISORS_ID      NUMBER(10)          NOT NULL,
      3    SUBMISSION_ID           NUMBER(10)          NOT NULL,
      4    ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      5    FIRST_NAME           VARCHAR(50)          NULL,
      6    LAST_NAME           VARCHAR(50)          NULL,
      7    SUFFIX                VARCHAR(20)          NULL
      8  )
      9  /
    Table created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      3    VALUES (1, 'Some Research Paper')
      4  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      5    VALUES (2, 'Thesis on 17th Century Weather Patterns')
      6  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      7    VALUES (3, 'Statistical Analysis on Sunny Days in March')
      8  SELECT * FROM DUAL
      9  /
    3 rows created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      3    VALUES (1, 'Department Chair')
      4  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      5    VALUES (2, 'Department Co-Chair')
      6  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      7    VALUES (3, 'Professor')
      8  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      9    VALUES (4, 'Associate Professor')
    10  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
    11    VALUES (5, 'Scientist')
    12  SELECT * FROM DUAL
    13  /
    5 rows created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      3    VALUES (1,1,2,'John', 'Doe', 'PhD')
      4  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      5    VALUES (2,1,2,'Jane', 'Doe', 'PhD')
      6  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      7    VALUES (3,2,3,'Johan', 'Smith', NULL)
      8  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      9    VALUES (4,2,4,'Magnus', 'Jackson', 'MS')
    10  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
    11    VALUES (5,3,5,'Williard', 'Forsberg', 'AMS')
    12  SELECT * FROM DUAL
    13  /
    5 rows created.
    SCOTT@orcl_11gR2> -- constraints presumed based on your description:
    SCOTT@orcl_11gR2> ALTER TABLE submission ADD CONSTRAINT submission_id_pk
      2    PRIMARY KEY (submission_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE advisor_type ADD CONSTRAINT advisor_type_id_pk
      2    PRIMARY KEY (advisor_type_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_advisors_id_pk
      2    PRIMARY KEY (submission_advisors_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_id_fk
      2    FOREIGN KEY (submission_id) REFERENCES submission (submission_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT advisor_type_id_fk
      2    FOREIGN KEY (advisor_type_id) REFERENCES advisor_type (advisor_type_id)
      3  /
    Table altered.
    SCOTT@orcl_11gR2> -- resulting data:
    SCOTT@orcl_11gR2> COLUMN submission_name FORMAT A45
    SCOTT@orcl_11gR2> COLUMN advisor      FORMAT A40
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  sa.advisor_type_id = a.advisor_type_id
    10  AND    sa.submission_id = s.submission_id
    11  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    Statistical Analysis on Sunny Days in March   Scientist Williard Forsberg AMS
    5 rows selected.
    SCOTT@orcl_11gR2> -- procedure to create virtual documents:
    SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE submission_advisors_proc
      2    (p_rowid IN           ROWID,
      3       p_clob     IN OUT NOCOPY CLOB)
      4  AS
      5  BEGIN
      6    FOR r1 IN
      7        (SELECT *
      8         FROM      submission_advisors
      9         WHERE  ROWID = p_rowid)
    10    LOOP
    11        IF r1.first_name IS NOT NULL THEN
    12          DBMS_LOB.WRITEAPPEND (p_clob, 12, '<first_name>');
    13          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.first_name), r1.first_name);
    14          DBMS_LOB.WRITEAPPEND (p_clob, 13, '</first_name>');
    15        END IF;
    16        IF r1.last_name IS NOT NULL THEN
    17          DBMS_LOB.WRITEAPPEND (p_clob, 11, '<last_name>');
    18          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.last_name), r1.last_name);
    19          DBMS_LOB.WRITEAPPEND (p_clob, 12, '</last_name>');
    20        END IF;
    21        IF r1.suffix IS NOT NULL THEN
    22          DBMS_LOB.WRITEAPPEND (p_clob, 8, '<suffix>');
    23          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.suffix), r1.suffix);
    24          DBMS_LOB.WRITEAPPEND (p_clob, 9, '</suffix>');
    25        END IF;
    26        FOR r2 IN
    27          (SELECT *
    28           FROM   submission
    29           WHERE  submission_id = r1.submission_id)
    30        LOOP
    31          DBMS_LOB.WRITEAPPEND (p_clob, 17, '<submission_name>');
    32          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r2.submission_name), r2.submission_name);
    33          DBMS_LOB.WRITEAPPEND (p_clob, 18, '</submission_name>');
    34        END LOOP;
    35        FOR r3 IN
    36          (SELECT *
    37           FROM   advisor_type
    38           WHERE  advisor_type_id = r1.advisor_type_id)
    39        LOOP
    40          DBMS_LOB.WRITEAPPEND (p_clob, 19, '<advisor_type_name>');
    41          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r3.advisor_type_name), r3.advisor_type_name);
    42          DBMS_LOB.WRITEAPPEND (p_clob, 20, '</advisor_type_name>');
    43        END LOOP;
    44    END LOOP;
    45  END submission_advisors_proc;
    46  /
    Procedure created.
    SCOTT@orcl_11gR2> SHOW ERRORS
    No errors.
    SCOTT@orcl_11gR2> -- examples of virtual documents that procedure creates:
    SCOTT@orcl_11gR2> DECLARE
      2    v_clob  CLOB := EMPTY_CLOB();
      3  BEGIN
      4    FOR r IN
      5        (SELECT ROWID rid FROM submission_advisors)
      6    LOOP
      7        DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
      8        submission_advisors_proc (r.rid, v_clob);
      9        DBMS_OUTPUT.PUT_LINE (v_clob);
    10        DBMS_LOB.FREETEMPORARY (v_clob);
    11    END LOOP;
    12  END;
    13  /
    <first_name>John</first_name><last_name>Doe</last_name><suffix>PhD</suffix><submission_name>Some
    Research Paper</submission_name><advisor_type_name>Department Co-Chair</advisor_type_name>
    <first_name>Jane</first_name><last_name>Doe</last_name><suffix>PhD</suffix><submission_name>Some
    Research Paper</submission_name><advisor_type_name>Department Co-Chair</advisor_type_name>
    <first_name>Johan</first_name><last_name>Smith</last_name><submission_name>Thesis on 17th Century
    Weather Patterns</submission_name><advisor_type_name>Professor</advisor_type_name>
    <first_name>Magnus</first_name><last_name>Jackson</last_name><suffix>MS</suffix><submission_name>The
    sis on 17th Century Weather Patterns</submission_name><advisor_type_name>Associate
    Professor</advisor_type_name>
    <first_name>Williard</first_name><last_name>Forsberg</last_name><suffix>AMS</suffix><submission_name
    Statistical Analysis on Sunny Days inMarch</submission_name><advisor_type_name>Scientist</advisor_type_name>
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- user_datastore that uses procedure:
    SCOTT@orcl_11gR2> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE ('sa_datastore', 'USER_DATASTORE');
      3    CTX_DDL.SET_ATTRIBUTE ('sa_datastore', 'PROCEDURE', 'submission_advisors_proc');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- index (on optional extra column) that uses user_datastore and section group:
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD (any_column VARCHAR2(1))
      2  /
    Table altered.
    SCOTT@orcl_11gR2> CREATE INDEX submission_advisors_idx
      2  ON submission_advisors (any_column)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  PARAMETERS
      5    ('DATASTORE     sa_datastore
      6        SECTION GROUP     CTXSYS.AUTO_SECTION_GROUP')
      7  /
    Index created.
    SCOTT@orcl_11gR2> -- what is tokenized, indexed, and searchable:
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$submission_advisors_idx$i
      2  /
    TOKEN_TEXT
    17TH
    ADVISOR_TYPE_NAME
    AMS
    ANALYSIS
    ASSOCIATE
    CENTURY
    CHAIR
    CO
    DAYS
    DEPARTMENT
    DOE
    FIRST_NAME
    FORSBERG
    JACKSON
    JANE
    JOHAN
    JOHN
    LAST_NAME
    MAGNUS
    MARCH
    PAPER
    PATTERNS
    PHD
    PROFESSOR
    RESEARCH
    SCIENTIST
    SMITH
    STATISTICAL
    SUBMISSION_NAME
    SUFFIX
    SUNNY
    THESIS
    WEATHER
    WILLIARD
    34 rows selected.
    SCOTT@orcl_11gR2> -- sample searches across all data:
    SCOTT@orcl_11gR2> VARIABLE search_string VARCHAR2(100)
    SCOTT@orcl_11gR2> EXEC :search_string := 'professor'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string) > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'doe'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'paper'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> -- sample searches within specific columns:
    SCOTT@orcl_11gR2> EXEC :search_string := 'chair'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN advisor_type_name') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'phd'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN suffix') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    2 rows selected.
    SCOTT@orcl_11gR2> EXEC :search_string := 'weather'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN submission_name') > 0
    10  AND    sa.advisor_type_id = a.advisor_type_id
    11  AND    sa.submission_id = s.submission_id
    12  /
    SUBMISSION_NAME                               ADVISOR
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    2 rows selected.

  • Oracle 9.2 ConText index alternate_spelling problem

    Hello everybody!
    I'm having problems with a ConText index in Oracle 9.2, using the alternative_spelling parameter...
    Here is my code
    CREATE TABLE U2000P.TEST_FICHIER_INT
    (ID NUMBER(6) NOT NULL,
    NOM_FICHIER VARCHAR2(90) NULL,
    MIME VARCHAR2(90) NULL,
    FICHIER BLOB DEFAULT empty_blob(),
    LNG VARCHAR2(3) NULL,
    KEY_WORDS VARCHAR2(500) NULL,
    CONSTRAINT PK_TEST_FICHIER_INT PRIMARY KEY (ID)
    EXECUTE CTX_DDL.CREATE_PREFERENCE('ENGLISH_LEXER','BASIC_LEXER');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('ENGLISH_LEXER', 'INDEX_THEMES', 'YES');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('ENGLISH_LEXER', 'THEME_LANGUAGE', 'ENGLISH');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('ENGLISH_LEXER', 'BASE_LETTER', 'NO');
    EXECUTE CTX_DDL.CREATE_PREFERENCE('FRENCH_LEXER','BASIC_LEXER');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('FRENCH_LEXER', 'INDEX_THEMES', 'NO');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('FRENCH_LEXER', 'BASE_LETTER', 'NO');
    EXECUTE CTX_DDL.CREATE_PREFERENCE('GERMAN_LEXER','BASIC_LEXER');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('GERMAN_LEXER', 'INDEX_THEMES', 'NO');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('GERMAN_LEXER', 'BASE_LETTER', 'NO');
    EXECUTE CTX_DDL.SET_ATTRIBUTE('GERMAN_LEXER', 'ALTERNATE_SPELLING', 'GERMAN');
    EXECUTE CTX_DDL.CREATE_PREFERENCE('GLOBAL_LEXER','MULTI_LEXER');
    EXECUTE CTX_DDL.ADD_SUB_LEXER('GLOBAL_LEXER', 'FRENCH', 'FRENCH_LEXER', '1');
    EXECUTE CTX_DDL.ADD_SUB_LEXER('GLOBAL_LEXER', 'DEFAULT', 'GERMAN_LEXER');
    EXECUTE CTX_DDL.ADD_SUB_LEXER('GLOBAL_LEXER', 'ENGLISH', 'ENGLISH_LEXER', '5');
    CREATE INDEX IDX_F_TEST_FICHIER_INT
    ON TEST_FICHIER_INT(FICHIER)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('DATASTORE CTXSYS.DIRECT_DATASTORE
    FILTER CTXSYS.INSO_FILTER
    LEXER GLOBAL_LEXER LANGUAGE COLUMN LNG');
    In one of the files that I load, I have the word 'paläontologie'
    Here are my searches
    select nom_fichier, score(1) from test_fichier_int where contains(fichier, 'paläontologie', 1) > 0;
    -> no rows selected
    select nom_fichier, score(1) from test_fichier_int where contains(fichier, 'palaontologie', 1) > 0;
    -> Finds my document
    Why does the first search not work?
    If I don't use the 'alternate_spelling' parameter, both searches don't work, why is that???
    Thanks in advance for your help
    Best regards
    Neil.

    I found my error!!!! Thanks Neil... lol
    In fact, it's my SQL*Plus that must be badly configured, and I am having problems with accentuated characters... If I search through a browser, it works!!!
    Sorry about that...
    Best regards
    Neil.

  • Oracle Text Context index keeps growing. Optimize seems not to be working

    Hi,
    In my application I needed to search through many varchar columns from differents tables.
    So I created a materialized view in which I concatenate those columns, since they exceed the 4000 characters I merged them concatenating the columns with the TO_CLOBS(column1) || TO_CLOB(column)... || TO_CLOB(columnN).
    The query is complex, so the refresh is complete on demand for the view. We refresh it every 2 minutes.
    The CONTEXT index is created with the sync on commit parameter.
    The index then is synchronized every two minutes.
    But when we run the optimize index it does not defrag the index. So it keeps growing.
    Any idea ?
    Thanks, and sorry for my poor english.
    Edited by: detryo on 14-mar-2011 11:06

    What are you using to determine that the index is fragmented? Can you post a reproducible test case? Please see my test of what you described below, showing that the optimization does defragment the index.
    SCOTT@orcl_11gR2> -- table:
    SCOTT@orcl_11gR2> create table test_tab
      2    (col1  varchar2 (10),
      3       col2  varchar2 (10))
      4  /
    Table created.
    SCOTT@orcl_11gR2> -- materialized view:
    SCOTT@orcl_11gR2> create materialized view test_mv3
      2  as
      3  select to_clob (col1) || to_clob (col2) clob_col
      4  from   test_tab
      5  /
    Materialized view created.
    SCOTT@orcl_11gR2> -- index with sync(on commit):
    SCOTT@orcl_11gR2> create index test_idx
      2  on test_mv3 (clob_col)
      3  indextype is ctxsys.context
      4  parameters ('sync (on commit)')
      5  /
    Index created.
    SCOTT@orcl_11gR2> -- inserts, commits, refreshes:
    SCOTT@orcl_11gR2> insert into test_tab values ('a', 'b')
      2  /
    1 row created.
    SCOTT@orcl_11gR2> commit
      2  /
    Commit complete.
    SCOTT@orcl_11gR2> exec dbms_mview.refresh ('TEST_MV3')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> insert into test_tab values ('c a', 'b d')
      2  /
    1 row created.
    SCOTT@orcl_11gR2> commit
      2  /
    Commit complete.
    SCOTT@orcl_11gR2> exec dbms_mview.refresh ('TEST_MV3')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- query works:
    SCOTT@orcl_11gR2> select * from test_mv3
      2  where  contains (clob_col, 'ab') > 0
      3  /
    CLOB_COL
    ab
    c ab d
    2 rows selected.
    SCOTT@orcl_11gR2> -- fragmented index:
    SCOTT@orcl_11gR2> column token_text format a15
    SCOTT@orcl_11gR2> select token_text, token_first, token_last, token_count
      2  from   dr$test_idx$i
      3  /
    TOKEN_TEXT      TOKEN_FIRST TOKEN_LAST TOKEN_COUNT
    AB                        1          1           1
    AB                        2          3           2
    C                         3          3           1
    3 rows selected.
    SCOTT@orcl_11gR2> -- optimizatino:
    SCOTT@orcl_11gR2> exec ctx_ddl.optimize_index ('TEST_IDX', 'REBUILD')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> -- defragmented index after optimization:
    SCOTT@orcl_11gR2> select token_text, token_first, token_last, token_count
      2  from   dr$test_idx$i
      3  /
    TOKEN_TEXT      TOKEN_FIRST TOKEN_LAST TOKEN_COUNT
    AB                        2          3           2
    C                         3          3           1
    2 rows selected.
    SCOTT@orcl_11gR2>

  • Stop words handling with CONTEXT index - weird behavior

    I have a context index with the following output from the report (describe index report).
    CTX_REPORT.DESCRIBE_INDEX('KWTI10569_20121010115054')
    ===========================================================================
    INDEX DESCRIPTION
    ===========================================================================
    index name: "METCALF_T"."KWTI10569_20121010115054"
    index id: 1524
    index type: context
    base table: "METCALF_T"."KWTD10569_20121010115054"
    primary key column:
    text column: MESSAGE_CONTENT
    text column type: RAW(2000)
    language column:
    format column: FMT
    charset column: CSET
    ===========================================================================
    INDEX OBJECTS
    ===========================================================================
    datastore: DIRECT_DATASTORE
    filter: CHARSET_FILTER
    charset: UTF8
    section group: NULL_SECTION_GROUP
    lexer: BASIC_LEXER
    punctuations: .?!
    skipjoins: _-"'`~!@#$%^&*()+=|}{[]\:;<>?/,
    continuation: \-
    index_stems: NONE
    wordlist: BASIC_WORDLIST
    stemmer: ENGLISH
    fuzzy_match: GENERIC
    stoplist: BASIC_STOPLIST
    stop_word: how
    stop_word: however
    stop_word: i
    stop_word: if
    <trimmed for brevity of message......but all default stop words provided by Oracle has been added here>
    storage: BASIC_STORAGE
    i_table_clause: tablespace TEXT_INDEX storage (initial 10M next 10M)
    k_table_clause: tablespace TEXT_INDEX storage (initial 10M next 10M)
    r_table_clause: tablespace TEXT_INDEX storage (initial 1M) lob (data) store as (cache)
    n_table_clause: tablespace TEXT_INDEX storage (initial 1M)
    i_index_clause: tablespace TEXT_INDEX storage (initial 1M) compress 2
    DB: 10g (10.2.0.4)
    DB characterset: UTF8
    Distinct tokens from index:
    SQL> select distinct token_text from dr$KWTI10569_20121010115054$i;
    TOKEN_TEXT
    BLAH
    EXPIRE
    OFFER
    My text content:
    SQL>
    SQL> select distinct utl_raw.cast_to_varchar2(message_content) from KWTD10569_20121010115054;
    UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT)
    blah blah offer will expire blah blah
    offer expire
    this offer shall expire
    offer to expire
    offer expire
    blah blah offer expire blah blah
    blah blah offer to expire blah blah
    blah blah offer expire blah blah
    offer will expire
    blah blah this offer shall expire blah blah
    10 rows selected.
    Now, when i perform some contain queries i get some behavior that i cant understand.
    When i search for "this offer will expire" i dont get every row (10 rows) - why is that?
    SQL> select UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT) from KWTD10569_20121010115054 where contains(message_content,'this offer will expire')>0;
    UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT)
    blah blah offer will expire blah blah
    this offer shall expire
    blah blah offer to expire blah blah
    blah blah this offer shall expire blah blah
    Also, when i search for "offer expire" i get the following
    SQL> select UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT) from KWTD10569_20121010115054 where contains(message_content,'offer expire')>0;
    UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT)
    offer expire
    blah blah offer expire blah blah
    blah blah offer expire blah blah
    offer expire
    I was thinking that the stop words will be ignored while searching in context grammar, so i would get all my rows back? Isnt that correct?
    What i really want to achieve is that all these stop words are stripped from the content AND the keywords when i run the query and i get 100% matches. Any pointers on how that can be accomplished?

    Roger-
    Thanks again. Is there any place in Oracle doc that documents these two facts?
    Please see the example below, does the number of words also matter? My search phrase was "the offer will expire" but why is that i didnt get rows like "offer to expire" back?
    SQL> select distinct utl_raw.cast_to_varchar2(message_content) from KWTD10569_20121010115054;
    UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT)
    offer expire
    blah blah offer expire blah blah
    blah blah offer will expire blah blah
    this offer shall expire
    offer expire
    offer to expire
    blah blah offer to expire blah blah
    blah blah offer expire blah blah
    offer will expire
    blah blah this offer shall expire blah blah
    10 rows selected.
    SQL> select UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT) from KWTD10569_20121010115054 where contains(message_content,'the offer will expire')>0;
    UTL_RAW.CAST_TO_VARCHAR2(MESSAGE_CONTENT)
    blah blah offer will expire blah blah
    this offer shall expire
    blah blah offer to expire blah blah
    blah blah this offer shall expire blah blah

  • Help with context index with /, -, @

    Hi all!
    I have just start work with oracle. I have a problem with context index. Please help me. My problem is :
    I have two column 'name' and 'address'. I index two column with context index (for example : Two index have name is 'Index1' and 'Index 2' ). I set parameter ('STOPLIST ctxsys.empty_stoplist') and i insert four rows such as : ('A','80/3 cong hoa'), ('B','80-3 cong hoa'), ('C','80@3 cong hoa'), ('D','80 3 cong hoa'). But when i execute this select :
    select * from tablename where contains(address, '3 cong hoa') > 0
    Result will return to me 4 rows But i just want one rows is ('D', '80 3 cong hoa').
    I know oracle will convert character '/', '-', '@' to space so result will return 4 rows and i don't know how to oracle keep character '/', '-', '@' when oracle index. I just want to add with 'Index2' for column 'address' and i don't want to add with 'Index1' for column 'name'
    Please help me, and thanks for your attention

    So you want "/", "-" and "@" to link tokens, but you want "." to break numeric tokens?
    OK, we can do that - though it seems a slightly odd requirement.
    There are two special characters NUMJOIN and NUMGROUP which are used for purely numeric tokens. The default will vary by locale, but for English-speaking locales the defaults are "." and "," - so a number such as 1,234,567.89 will be treated as a single token. In French (and other) speaking locales, they are reversed since numbers are normally written as 1.234.567,89.
    If you want to disable these NUMJOIN and NUMGROUP characters, so that numbers are always split into component tokens, then you can set both of the to the space character (it won't allow NULL or '', which would be more logical in my opinion).
    drop table foo;
    create table foo (bar varchar2(200));
    insert into foo values ('80/3 cong hoa');
    insert into foo values ('80-3 cong hoa');
    insert into foo values ('80@3 cong hoa');
    insert into foo values ('80 3 cong hoa');
    insert into foo values ('80.3 cong hoa');
    exec ctx_ddl.drop_preference('foo_lexer')
    exec ctx_ddl.create_preference('foo_lexer', 'basic_lexer')
    exec ctx_ddl.set_attribute('foo_lexer', 'PRINTJOINS', '/-@')
    exec ctx_ddl.set_attribute('foo_lexer', 'PRINTJOINS', '/-@')
    exec ctx_ddl.set_attribute('foo_lexer', 'NUMJOIN', ' ')
    exec ctx_ddl.set_attribute('foo_lexer', 'NUMGROUP', ' ')
    create index foo_index on foo(bar) indextype is ctxsys.context
    parameters ('lexer foo_lexer');
    select * from foo where contains (bar, '3 cong hoa') > 0;Output is:
    BAR
    80 3 cong hoa
    80.3 cong hoa

  • XML context search with escape characters

    Hi,
    I have a piece of XML in an XMLTYPE column which is context indexed. The xml looks like
    &lt;content&gt;
    &lt;EndDate/&gt;
    &lt;Councillor&gt;Smith John&lt;/Councillor&gt;
    &lt;Committee&gt;Inspection Leader&amp;#039;s Advisory Body &lt;/Committee&gt;
    &lt;StartDate/&gt;
    &lt;LinkType&gt;Committee Link&lt;/LinkType&gt;
    &lt;Text/&gt;
    &lt;/content&gt;
    My query which escapes the search field between {} is
    select xmlType.getStringVal(xmlType.extract(CI.CONTENT_XML,'/content/Committee/text()')) Committee
    from CMPS.CM$CONTENT_ITEMS CI
    where CONTAINS(content_xml,'{Inspection&a} INPATH(/content/Committee)') &gt; 0
    returns the row successfully
    However
    select xmlType.getStringVal(xmlType.extract(CI.CONTENT_XML,'/content/Committee/text()')) Committee
    from CMPS.CM$CONTENT_ITEMS CI
    where CONTAINS(content_xml,'{Inspection&am} INPATH(/content/Committee)') &gt; 0
    --Note the extra character in between {}
    does not return anything.
    Can someone tell me if I am escaping the reserved characters correctly?
    Is there something that I missed when I created my index i.e
    CREATE INDEX CIM_CONTEXT ON
    cm$content_items(content_xml) indextype is ctxsys.context;
    I am running 9.2.0.4 on RED HAT 3.
    Thanks
    Joel.

    From the text team...
    The default section group for XMLType column is path section group.
    As for his question, the reason why he gets a hit for the first query:
    {Inspection&a} INPATH(/content/Committee), is because {Inspenction&a} is lexed as
    a phrase "Inspection a" and a by default is 'a' stop word.
    And {Inspection&am} is lexed as a phrase "Inspection am". Since there is no such phrase ("am" is not a stop word), the query does not return the row.
    If he tries {Inspection&an}, he will get the row because "an" is again by default a stop word.
    The behavior is independent of INPATH operator. He will see the same behavior without INPATH operator:
    select * from CMPS.CM$CONTENT_ITEMS CI where CONTAINS(content_xml,'{Inspection&a}') > 0;
    select * from CMPS.CM$CONTENT_ITEMS CI where CONTAINS(content_xml,'{Inspection&am}') > 0;
    select * from CMPS.CM$CONTENT_ITEMS CI where CONTAINS(content_xml,'{Inspection&an}') > 0;
    Note sure I understand it but I hope it helps

  • Creation of context index on index-organized table

    I encountered a problem when creating a domain index(intermediate text context index) on a index-organised table in oracle 8i.
    The description of the error is stated below:
    "ORA-29866: cannot create domain index on a column of index-organized table "
    I have configured intermediate text properly and even it worked for those tables which are not index-organised(ordinary tables).
    This problem has occured only when i made the tables as index organised.
    Please provide us a solution to this problem as early as possible.
    In case if you require any more details i shall provide them.

    Please ask questions about Oracle Text (formerly interMedia text) in the Oracle Text forum. You will get a quicker, more expert answer there.

  • Creation of context index on index-organized tables

    I encountered a problem when creating a domain index(intermediate text context index) on a index-organised table in oracle 8i.
    The description of the error is stated below:
    "ORA-29866: cannot create domain index on a column of index-organized table "
    I have configured intermediate text properly and even it worked for those tables which are not index-organised(ordinary tables).
    This problem has occured only when i made the tables as index organised.
    Please provide us a solution to this problem as early as possible.
    In case if you require any more details i shall provide them.

    creation of domain indexes (such as context) on iot's
    is not currently supported in oracle.

Maybe you are looking for

  • How do I publish and ibook for free without a credit card

    I am working with a teacher to publish her students work to the iBooks store. We are trying to download iTunes Connect.  She has tried to use her account and keeps hitting snags.  Her account information is correct but keeps getting rejected.  So I t

  • I want you to check why moderator locked my thread?

    I am a j2ee guy. from so long we are into this forum. I used to post and answer so many j2ee and java related threads. I have posted a thread and the discussion was going on, mean while in the discussion we ran into a geniric question on web applicat

  • Graph & Chart: select and colour single element of data series

    Hi, my question is about formatting Keynote graph: i.e. bar graph 2d or 3d, is it possible select and colour differently a single element of series? In Powerpoint exists that possibility, but in Keynote I can't find the way to select only one element

  • 1707: Unable to connect to database

    If I select the properties of our ZFS database and click on the RM Audit tab I get an error message "1701: Unable to connect to the database. Check if the database is running". Now I know the database is running as I can see it on the server console

  • ADF button submits the whole page even on partial submit=true

    my jdev version 11.1.1.5.0 I hav a jspx page with two input boxes and three select one choice and a clear button on clicking the clear button it subimts the whole page and fetches value for select one choice mapped to manage bean everytime even on pu