Oracle Text, create index (indextype is ctxsys.context)

Dear Sirs,

I am a new user of text Oracle (Oracle 11 g release 11.2) and I'm unable to create an index of type ctxsys.context). Any suggestions? :

Code:
drop table mytable;
drop index myindex force;
create table mytable (id number primary key, docs clob);

insert into mytable values (111555, "this text will be indexed '");
insert into mytable values (111556, "it is an example of default data store");
commit;

create index myindex on mytable (docs)
indexType is ctxsys.context
parameters ("DATASTORE CTXSYS. DEFAULT_DATASTORE');
+++++++
error messages:
create index myindex on mytable (docs)
*
ERROR on line 1:
ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE
ORA-20000: Oracle text error:
ORA-06508: PL/SQL: called program unit is not found
ORA-06512: at "CTXSYS. DRUE", line 160
ORA-06512: at "CTXSYS. TEXTINDEXMETHODS', line 366

Please check for invalid objects. Connect as sys or system and run:

Select object owner, object_name, object_type where status = 'INVALID ';

View the results here and we will advise the next step.
If all the objects owned by CTXSYS are not valid, you will need to recompile the schema CTXSYS.

Tags: Database

Similar Questions

  • Oracle Text corresponds to unexpected lines

    Hi people:

    I use Oracle Text in Oracle 12 c to search the text for a column that is indexed as follows:

    We will examine these lines.

    • Table X
    Text
    90-SE
    90-BA
    Hello

    I want to search the text "90-SE", then I did the following SQL query:

    SELECT TEXT, SCORE (1)

    X

    WHERE CONTAINS (TEXT, '90\ - SE', 1) > 0;

    The result is:

    Score (1) TEXT
    590-SE
    590-BA

    I can't understand why it is corresponding to the line containing 90-BA.

    Thank you

    ytor

    I am unable to reproduce your error, but I do not know what lexer attributes and others you may have.  I don't know if you are aware that unless you set the hyphen as a printjoin it is not indexed.  Please see the demo below, noting the differences in the token_text.

    Scott@ORCL > select version banner $ v

    2.

    BANNER

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

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

    PL/SQL Release 12.1.0.2.0 - Production

    CORE Production 12.1.0.2.0

    AMT for 64-bit Windows: Version 12.1.0.2.0 - Production

    NLSRTL Version 12.1.0.2.0 - Production

    5 selected lines.

    Scott@ORCL > create table x

    2 (text varchar2 (60))

    3.

    Table created.

    Scott@ORCL > insert all

    2 in the x values (90-SE "")

    3 in x values (90-BA "")

    values ('Hello') x 4

    5 Select * of the double

    6.

    3 lines were created.

    Scott@ORCL > create index x_text_idx on x (text)

    2 indextype is ctxsys.context

    3.

    The index is created.

    Scott@ORCL > select Dr. token_text $ x_text_idx$ I

    2.

    TOKEN_TEXT

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

    90

    BA

    Hello

    IS

    4 selected lines.

    Scott@ORCL > SCORE (1) SELECT, TEXT

    2 X

    3. WHERE CONTAINS (TEXT, '90\ - SE', 1) > 0

    4.

    SCORE (1) TEXT

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

    4 90-SE

    1 selected line.

    Scott@ORCL > start

    2 ctx_ddl.create_preference ('test_lex', 'basic_lexer');

    3 ctx_ddl.set_attribute ('test_lex', 'printjoins', '-');

    4 end;

    5.

    PL/SQL procedure successfully completed.

    Scott@ORCL > drop index x_text_idx

    2.

    The index is deleted.

    Scott@ORCL > create index x_text_idx on x (text)

    2 indextype is ctxsys.context

    3 parameters ("lexer test_lex")

    4.

    The index is created.

    Scott@ORCL > select Dr. token_text $ x_text_idx$ I

    2.

    TOKEN_TEXT

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

    90-BA

    90-SE

    Hello

    3 selected lines.

    Scott@ORCL > SCORE (1) SELECT, TEXT

    2 X

    3. WHERE CONTAINS (TEXT, '90\ - SE', 1) > 0

    4.

    SCORE (1) TEXT

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

    4 90-SE

    1 selected line.

  • Oracle text index - unexpected behavior

    We have a SEARCH_TABLE (in Oracle 12.1.0.1.0) with a couple of files (actually about 10,000,000 records):

    ID ADDRESS

    1     | WIMPEL | 57. 9733BK | GRONINGEN |

    2     | JOHAN WILSSTRAAT | 7 ||| 1333PV | ALMERE |

    3     | ABRAHAM KUYPERHOF | 10. 8091XN | WEZEP |


    To support research on the table addresses, we apply an Oracle text index:

    create index ST_CTX1 on SEARCH_TABLE (address)

    indexType is ctxsys.context

    parameters ("DATASTORE CTXSYS. DEFAULT_DATASTORE');


    Our research focuses on whole words (without jokers). When searching through the data, it usually comes back with the correct results.


    SELECT THE ID

    OF SEARCH_TABLE

    WHERE CONTAINS (ADDRESS, 'GRÖNING') > 0

    ;

    Returns nothing, that is correct. Once the search argument 'GRÖNING' is replaced by 'GRONINGEN', ID 1 is correctly selected. According to this behavior, the following query returns no records:

    SELECT THE ID

    OF SEARCH_TABLE

    WHERE CONTAINS (ADDRESS, 'ABR & KUYPERHOF') > 0

    ;


    Surprisingly, however, the following query returns record ID 3:

    SELECT THE ID

    OF SEARCH_TABLE

    WHERE CONTAINS (ADDRESS, ' A & KUYPERHOF ') > 0

    ;

    (Even if data does not contain the complete word 'A'). This unexpected behavior only seems to occur when you use "A" as the initial character.

    The following query (with the search starting with the character 'J' argument) returns no data. Which is the expected behavior.

    SELECT the ID

    OF SEARCH_TABLE

    WHERE CONTAINS (ADDRESS, 'J & WILSSTRAAT') > 0

    ;

    Anyone has an idea why the text index returns with A situations? Any ideas on how to solve this problem are appreciated.

    Mark

    According to the list of empty words by default in 11.2, the letters a, d, i, s, and t are listed, so would be removed from the wanted list of tokens.  Thus, 'A & WILSSTRAAT' becomes '& WILSTRAAT' and search text line with a single word.  'j' is not an empty word, so it is considered to be a token is valid and is not in your tables.  Look in CTXSYS. CTX_STOPWORDS to see what you have.

  • All parameter memory index for Oracle text indexes

    Hi Experts,

    I'm on Oracle 11.2.0.3 on Linux and have implemented Oracle Text. I'm not an expert in this area and need help on a question. I created the Oracle text index with the default setting. However, in a white paper of oracle, I read that the default setting is perhaps not good. Excerpt from the white paper by Roger Ford:

    URL:http://www.oracle.com/technetwork/database/enterprise-edition/index-maintenance-089308.html

    "(Part of this white paper below. )" ...)

    Index memory as mentioned above, $I entries cached emptied out on the disk each time the indexing memory is exhausted. The default index to installing memory is a simple 12MB, which is very low. At the time of creating indexes, users can specify up to 50 MB, but it is still quite low.                                   

    This would be by a CREATE INDEX, something like statement:

     CREATE INDEX myindex ON mytable(mycol) INDEXTYPE IS ctxsys.context PARAMETERS ('index memory 50M');  

    Allow index of the parameters of memory beyond 50 MB, the CTXSYS user must first of all increase the value of the MAX_INDEX_MEMORY parameter, like this:

     begin ctx_adm.set_parameter('max_index_memory', '500M'); end;  

    The parameter memory must never be high point causes paging, because this will have a serious effect on indexing speed. The smallest of dedicated systems, it is sometimes advantageous to temporarily reduce the amount of memory consumed by the Oracle SGA (for example by reducing DB_CACHE_SIZE and/or SHARED_POOL_SIZE) during the index creation process. Once the index has been created, the size of the SGA can be increased again to improve query performance. & quot;

    (End of the excerpt from the white paper)


    My question is:

    (1) to apply this procedure (ctx_adm.set_parameter) obliged me to log on as user CTXSYS. Is this fair? or can it be avoided and will be based on the application schema? The CTXSYS user is locked by default and I had to unlock it. Is this OK to do it in production?

    (2) what value I should use for the max_index_memory there are 500 MB - my SGA is 2 GB in Dev / QA and / 3 GB in the production. Also in the creation of the index which is the value should I set for the parameter memory index - I had left to default, but how do I change now? Should it be 50 MB as shown in the example above?

    (3) the white paper also refer to the reconstruction of an index to an interval like once a month: ALTER INDEX DR$ index_name$ X REBUILD online;

    -Is this good advice? I would like to ask the experts once before doing this.  We are on Oracle 11 g and the white paper was drafted in 2003.

    Basically, while I read the book, I'm still not clear on many aspects and need help to understand this.

    Thank you

    OrauserN

    Index entries are built in memory, and then flushed to disk, memory is exhausted. With a setting of high index memory will mean the index entries can be longer and less fragmented, which provides better performance of the query.  Conversely, a small memory parameter index will mean emptied the disk pieces are smaller, so queries (especially on common words) will have to do a lot more e/s to extract several pieces of index for the words.

  • Oracle Text, multi_column_datastore describe index

    Referring to the Re: Oracle Text, ctxsys.context problem with column number

    TOAD or SQL Navigator, you can click on an object any (such as a table, index) and click on the "script" tab where the code is generated to create.

    Assuming that I am a person who sees the index for the first time where/how I can find multi_columns/settings with which the index has been created?

    For example:
    exec ctx_ddl.drop_preference( 'myds' );
    exec ctx_ddl.create_preference( 'myds', 'MULTI_COLUMN_DATASTORE' );
    exec ctx_ddl.set_attribute( 'myds', 'COLUMNS', 'item_barcode, item_title, item_subtitle' );
    CREATE INDEX i_index_test
       ON item (item_title)
       INDEXTYPE IS ctxsys.context
       PARAMETERS ( 'datastore myds' );
    And script says:
    CREATE INDEX PLSQL.I_INDEX_TEST ON PLSQL.ITEM
    (ITEM_TITLE)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('datastore myds')
    NOPARALLEL;
    Where can I find datastore "myds"?

    You can use ctx_report to get information about an index.

    I use it for SQL * more like this:

    set pagesize 0
    set heading off
    set trimspool on
    set long 500000
    
    spool index.sql
    
    select ctx_report.create_index_script('MyIndexName') from dual;
    
    spool off
    

    The only thing it will not give you is the source for all of the procedures used in the user_datastore. You can get to user_sources.

  • Oracle Text multi column index based query returns no rows

    Hello

    I have a MAH_KERESES_MV table with 3 columns OBJEKTUM_NEV, KERESES_SZOVEG_1, KERESES_SZOVEG_2. I create the following Oracle multi column text index:

    ctx_ddl.create_preference exec ('MAH_SEARCH', 'MULTI_COLUMN_DATASTORE');
    ctx_ddl.set_attribute exec ('MAH_SEARCH', 'COLUMNS', 'OBJEKTUM_NEV, KERESES_SZOVEG_1, KERESES_SZOVEG_2');

    create index MAX_KERES_CTX on MAH_KERESES_MV (OBJEKTUM_NEV)
    indexType is ctxsys.context
    parameters ("DATASTORE MAH_SEARCH");
    But the query returns no rows, although if I make the query with the 'like' operator, and then I get the results as expected:

    SELECT id, OBJEKTUM_NEV
    OF MAH_KERESES_MV
    WHERE CONTAINS (OBJEKTUM_NEV, "C") > 0;

    Can some body please help? TIA,

    Tamas

    You can do it in Oracle Text, well it is not necessarily desirable.

    You can search the

    WHERE CONTAINS(OBJEKTUM_NEV, '%C%')>0;
    

    And it will probably work in a simple test. However, using a leader like this wildcard prevents them the index on the table "list of words" used, so such a request can be very slow on a large system.
    You can improve this by using SUBSTRING_INDEX, but making your much bigger index. And you could always hit the 'expansions too' problem if %C % expansion is more than about 15,000 words (depending on version and different settings).

    Also be aware of differences in case - %C % will match 'fact' or 'FACT', as part of a CONTAINS, but not part of a TYPE.

  • ORACLE TEXT INDEX ON COLUMN VARCHAR2

    Hi all
    I find a search in our application very slow so I thought using ORACLE TEXT CTXCAT index based search but I find some inconsistencies. How can this be avoided... The following query should not return if I can replace with the text of the oracle, but I find few values... why result... I also gave some results of the sample below...

    SELECT first_name
    Of uc_partner_ms
    WHERE
    Upper (first_name) LIKE '% WIE % '.
    less
    SELECT first_name
    Of uc_partner_ms
    WHERE CATSEARCH (name,'* wie *', null) > 0

    RESULTS...

    Hans-Werner Mrowiec
    Heinz Oesterwiemann GmbH
    Helmut Froitzheim GmbH, Neuwied
    Heribert Schwies
    Hermann Twieling GmbH & Co. KG
    Breitwieser Horst
    Horst-Dieter Swie

    The script used to create indexes is

    Start
    ctx_ddl.create_preference ('mylex', 'BASIC_LEXER');
    ctx_ddl.set_attribute ('mylex', 'index_themes', 'NO');
    ctx_ddl.set_attribute ('mylex', 'mixed_case', 'NO');
    end;

    CREATE INDEX partner_index ON uc_partner_ms (first name)
    INDEXTYPE IS CTXSYS. CTXCAT
    parameters ('mylex LEXER');


    Where am I wrong that I couldn't guess a trend in the other that all results be lowercase...

    (1) what is the difference tag brings in the query?

    This is the QUERY MODEL, which allows you to use the CONTEXT GRAMMAR on the CTXCAT index, as if you were using CONTAINS. There are examples in the documentation here:

    http://download.Oracle.com/docs/CD/B19306_01/text.102/b14218/csql.htm#i1000002

    (2) is it a good idea to replace catsearch for like operator leader %?

    The wildcard character for a CATSEARCH operator on a CTXCAT index is the asterisk. The wildcard character for an operator CONTAINS a CONTEXT index is a percent sign. CATSEARCH does not support major wildcards, you can use a word followed by an asterisk, but not preceded by an asterisk. The percent sign is not a valid wildcard with CATSEARCH. However, when you use the query template and specify GRAMMAR = "CONTEXT". Then, it's as if you were using a CONTAINS operator with a CONTEXT index, so you can use a wildcard of beginning and the % sign is the wildcard character. You can use AS with signs of percentage before and after, but it is likely to be very slow, because it cannot use an index. If the main characters using generic is going to be a frequent requirement, then you would probably be better with a hint of CONTEXT with a BASIC_WORDLIST valued SUBSTRING_INDEX true for optimal speed.

    (3) also, I read in 10 g, the maximum number of rows returned is only 15000. is this true?

    N ° you probably read about the WILDCARD_MAXTERMS of 15,000 in 10 g limit. This is the maximum number of separate tokens (not lines) that can match a wildcard character without producing an error. In 11g the maximum is 50,000. The default values are lower. If you want to allow a large number of generic searches that match a large number of chips, then you probably assign the WILDCARD_MAXTERMS the most. However, there will always be some queries that are too general, you should plan to trap the error and returns a comprehensible message to your user, asking them that their search is too broad and to enter a value for more specific search.

  • ORA-20000: Oracle text error: 10599-DRG: column is not indexed

    Hi all

    I am using Oracle 11.2, and DRG-10599 error when I used contains and have ctxsys.context index as follows:

    create the table tb_nm
    (
    VARCHAR2 (32) nm.
    addr clob
    );

    create index idx_addr on tb_nm (addr) indextype is ctxsys.context
    parameters (' storage idx_addr lexer TEXT_LEXER sync (on commit) ");

    Select * from tb_nm where contains (addr, "How are") > 0;

    Any suggestion?

    Thank you!

    Then you have the answer. Most likely, something was wrong during the import. Let drop and re-create the index.

    SY.

  • Oracle text index does not return the expected results.

    Hello

    My project requires a generic search on 5 different columns and all the VARCHAR2 data type.
    As performance is very slow with AS % search, I try to use for the multi_column_datastore that is recommended for this.

    Here's what I did.

    1 - Create table.
    CREATE TABLE BILLING_SCHEMA.NAMES_TABLE ( 
        ID                  NUMBER(9,0) NOT NULL,
        ENTITY_NUMBER         VARCHAR2(30) NOT NULL,
        GIVEN_NAMES         VARCHAR2(50) NULL,
        SURNAME             VARCHAR2(30) NULL,
        ORGANISATION_NAME     VARCHAR2(60) NULL,
        DISPLAY_NAME        VARCHAR2(100) NULL 
        )
    /
    
     
    My search must be made on the columns ENTITY_NUMBER, GIVEN_NAMES, surname, ORGANISATION_NAME and DISPLAY_NAME.

    2. - insert values into the table
    INSERT INTO NAMES_TABLE VALUES(1, 'GH', NULL, NULL, NULL, 'GROUP OF HOSPITAL')
    /
    INSERT INTO NAMES_TABLE VALUES(2, 'DH', NULL, NULL, NULL, 'DEPARTMENT OF HEALTH')
    /
    INSERT INTO NAMES_TABLE VALUES(3, 'REC', NULL, NULL, NULL, 'DEBTOR FOR RECEIPTS')
    /
    INSERT INTO NAMES_TABLE VALUES(4, 'UN_REC', NULL, NULL, NULL, 'DEBTOR FOR UNMATCHED RECEIPTS')
    /
    INSERT INTO NAMES_TABLE VALUES(5, 'SAM_FUND', NULL, NULL, NULL, 'THE S FUND')
    /
    
     
    3 - create context multi_column_datastore index
    BEGIN
    CTX_DDL.CREATE_PREFERENCE('NAMES_TABLE_MULTI', 'MULTI_COLUMN_DATASTORE');
    CTX_DDL.SET_ATTRIBUTE('NAMES_TABLE_MULTI', 'COLUMNS', 'ENTITY_NUMBER, GIVEN_NAMES, SURNAME, ORGANISATION_NAME, DISPLAY_NAME');
    END;
    
    CREATE INDEX NAMES_TABLE_IDX
    ON NAMES_TABLE(ENTITY_NUMBER)
    INDEXTYPE IS   CTXSYS.CONTEXT
    PARAMETERS ('DATASTORE NAMES_TABLE_MULTI')
    
     
    4 - create the trigger that should update the column ENTITY_NUMBER if everything is inserted/updated
    CREATE OR REPLACE TRIGGER NAMES_TABLE_TRIGGER
    BEFORE INSERT OR UPDATE OF GIVEN_NAMES, SURNAME, ORGANISATION_NAME, DISPLAY_NAME  ON NAMES_TABLE
    FOR EACH ROW
    BEGIN
      :NEW.ENTITY_NUMBER := :NEW.ENTITY_NUMBER;
    END
     
    5. the search query
    SELECT *
    FROM NAMES_TABLE
    WHERE  CONTAINS(ENTITY_NUMBER,'%TH%') > 0
     
    I am so very confused here because the result returned is only
    ID     ENTITY_NUMBER     GIVEN_NAMES     SURNAME     ORGANISATION_NAME     DISPLAY_NAME         
     2      DH                  (null)        (null)         (null)          DEPARTMENT OF HEALTH 
     
    When I wait for him that the 5th inserted record is returned too as it contains "THE S FUND" that begins with "TH".

    When I use the search string '% %' and %, no results are returned, although I expect at least two records in each case.

    I would appreciate help with this.

    Thanks in advance,
    Marilyn

    Published by: user5615580 on 08/03/2011 21:35

    Published by: user5615580 on 08/04/2011 16:33
  • Oracle Text returns no results when the string begins with two consecutive vowels

    Hello

    I hope someone can shed some light on a strange problem, that we face.

    Oracle Database 11 g R2 (11.2.0.4) EE 64 bit running on Windows 2008 Server R2.

    When I create an index of context on a column varchar2 (surname), it works fine when the surname begins with a consonant or a vowel. But when the family name starts with two vowels, that it fails to return the file?

    Please see example below:

    create table t1 (surname varchar2(50));
    
    insert into t1 values ('OURS');
    insert into t1 values ('JOURS');
    insert into t1 values ('ONES');
    
    commit;
    
    -- sync every 10 mins
    CREATE INDEX PERSON_SURNAME_IDX ON t1
    (SURNAME)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('MEMORY 50M sync (every "SYSDATE+10/1440")')
    NOPARALLEL;
    
    -- no rows
    SELECT surname 
    FROM t1
    WHERE CONTAINS(surname, 'OURS') > 0;
    
    -- 1 row
    SELECT surname 
    FROM t1
    WHERE CONTAINS(surname, 'JOURS') > 0;
    
    -- 1 row
    SELECT surname 
    FROM t1
    WHERE CONTAINS(surname, 'ONES') > 0;
    

    Any help or advice greatly appreciated.

    Thank you

    Ours is in the list of default stoplist (list of words that are ignored)

    http://docs.Oracle.com/CD/B19306_01/text.102/b14218/astopsup.htm#CEGBGCDF

  • How to create indexes of service according to

    Hi all

    I already post a thread associated with this thread, but there is little difference in the two threads.

    I had a query as below:

    Select concept_Un, raw_concept_a, relation_name, concept_b, discovered_relations raw_concept_b, where lower (concept_a) like '% of consumers' and lower (concept_a) like '% confidence % ';


    This query taking too long to run and its high rating.

    cost and execution time: 1155K and 03:51:11

    I changed above query using the Forum gurus, below query is changed:


    Select concept_Un, raw_concept_a, relation_name, concept_b, raw_concept_b

    of discovered_relations

    where regexp_instr (concept_Un, ' (consumer.*confidence) |) ((confidence.*Consumer))', 1, 1, 1, 'i') > 0;

    I created indexes for query modified as well:
    creating index SIDEV. IDX_reg_instr on SIDEV. DISCOVERED_RELATIONS (REGEXP_INSTR ("CONCEPT_A",'(consumer.*confidence) |)) (confidence.*Consumer))', 1, 1, 1, 'i'));

    After that the cost and time to get request reduces to:
    After optimization: 40001 and 08:01

    Now the question is whenever my request will vary as a condition, this means that search string can be vary to any value.

    So I need a basic index as function above is the index which can work for any string in the like operator, now my created index only works very well for the fixed string...

    Thank you

    Abbas85 wrote:

    Hi Chris,

    Thank you very much its working well, now, to reduce the cost and duration of execution, I used below queries as you suggest:

    create index idx_fulltext on discovered_relations (concept_a) indextype is ctxsys.context;

    Select * from discovered_relations

    where contains (concept_a, 'Confidence') > 0 and contains (concept_a, 'Consumer') > 0;

    Hello

    No, you didn't.

    The query I used was

    Select str

    of test_idx

    where

    contains (str, '% of the CONSUMPTION and CONFIDENCE %') > 0

    If you read carefully, you'll notice that I used already found lowercase uppercase searchwords.

    This works because the oracle text case insensitiv default you can read documentation:

    "By default, all text tokens are converted to uppercase and then indexed. This

    results in case-insensitive queries. For example, separate queries for each of

    the three words, CAT cat,

    "and Cat all return the same documents.

    Indexing with Oracle Text

    If you have more to use tiny but need to start to read the oracle text docs ;-)

  • The abbreviated word Oracle text query / name

    I am new to Oracle text so please excuse the simple question (probably). I want to be able to create a search that excludes (including?) special characters or spaces between the short name. I don't know if it's possible, but I would like to be able to return all results below if an interviewee in 'ABC' under one form or another.

    It would be something that I would add a thesaurus? In my view, there is a list of EMPTY words, but I don't know if it is the opposite of a list of empty words.

    Thanks in advance!

    Kind regards
    Rich

    set def off;
    
    drop table docs;
    
    CREATE TABLE docs (id NUMBER PRIMARY KEY, text VARCHAR2(200));
    
    INSERT INTO docs VALUES(1, 'ABC are my favorite letters.');
    INSERT INTO docs VALUES(2, 'My favorite letters are A,B,C');
    INSERT INTO docs VALUES(3, 'The best letters are A.B.C.');
    INSERT INTO docs VALUES(4, 'Three of the word letters are A-B-C.');
    INSERT INTO docs VALUES(5, 'A B C are great letters.');
    INSERT INTO docs VALUES(6, 'AB and C are easy letters to remember');
    INSERT INTO docs VALUES(7, 'What if we used A, B, & C?');
    
    commit;
    
    begin
    ctx_ddl.drop_preference('english_lexar');
    end;
    /
    
    begin
    ctx_ddl.create_preference('english_lexar', 'BASIC_LEXER');
    ctx_ddl.set_attribute('english_lexar', 'printjoins', '_-');
    ctx_ddl.set_attribute('english_lexar', 'skipjoins', '-.');
    --ctx_ddl.set_attribute ( 'english_lexar', 'index_themes', 'YES');
    ctx_ddl.set_attribute ( 'english_lexar', 'index_text', 'YES'); 
    ctx_ddl.set_attribute ( 'english_lexar', 'index_stems', 'SPANISH'); 
    ctx_ddl.set_attribute ( 'english_lexar', 'mixed_case', 'YES');
    ctx_ddl.set_attribute ( 'english_lexar', 'base_letter', 'YES');
    end;
    /
    
    begin
     ctx_ddl.drop_preference('STEM_FUZZY_PREF');
    end;
    /
    
    begin 
      ctx_ddl.create_preference('STEM_FUZZY_PREF', 'BASIC_WORDLIST'); 
      ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_MATCH','ENGLISH');
      ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_SCORE','0');
      ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_NUMRESULTS','5000');
      ctx_ddl.set_attribute('STEM_FUZZY_PREF','SUBSTRING_INDEX','TRUE');
      ctx_ddl.set_attribute('STEM_FUZZY_PREF','PREFIX_INDEX','TRUE');
      ctx_ddl.set_attribute('STEM_FUZZY_PREF','STEMMER','ENGLISH');
    end; 
    /
    
    begin
     ctx_ddl.drop_preference('wildcard_pref');
    end;
    /
    
    begin 
        Ctx_Ddl.create_Preference('wildcard_pref', 'BASIC_WORDLIST'); 
        ctx_ddl.set_attribute('wildcard_pref', 'wildcard_maxterms', 100) ;
    end; 
    /
    
    DROP index myindex;
    
    create index myindex on docs (text) 
      indextype is ctxsys.context 
      parameters ( 'LEXER english_lexar Wordlist wildcard_pref' ); 
    
    EXEC CTX_DDL.SYNC_INDEX('myindex', '2M');
    
    SELECT SCORE(1), id, text FROM docs WHERE CONTAINS(text, 'ABC', 1) > 0;
    Maybe it's that my SQL statement is not taking advantage of the text options - that is to say I forget something obvious :)

    The indexes are by default case insensitive, so let's ignore that.

    You can wal-mart and wal * mart match Wal-Mart by setting "-" and "*" as characters SKIPJOINS. However, you cannot not wal mart walmart match, otherwise than by the use of the NDATA.

    NDATA seems to work - any variation of wal mart Walmart wal * mart and wal-mart manage to match the Wal-Mart and wal-mart. See the example:

    SQL> create table testcase (text varchar2(2000));
    Table created.
    
    SQL> insert into testcase values ('walmart');
    1 row created.
    
    SQL> insert into testcase values ('wal mart');
    1 row created.
    
    SQL> exec ctx_ddl.drop_section_group('tcsg')
    PL/SQL procedure successfully completed.
    
    SQL> exec ctx_ddl.create_section_group('tcsg', 'xml_section_group')
    PL/SQL procedure successfully completed.
    
    SQL> exec ctx_ddl.add_ndata_section('tcsg', 'nd', 'nd')
    PL/SQL procedure successfully completed.
    
    SQL> create index testcase_index on testcase(text)
      2  indextype is ctxsys.context
      3  parameters ('section group tcsg')
      4  /
    Index created.
    
    SQL> select * from testcase where contains (text, 'ndata(nd, wal mart)') > 0;
    
    TEXT
    --------------------------------------------------------------------------------
    walmart
    wal mart
    
    SQL> select * from testcase where contains (text, 'ndata(nd, wal-mart)') > 0;
    
    TEXT
    --------------------------------------------------------------------------------
    walmart
    wal mart
    
    SQL> select * from testcase where contains (text, 'ndata(nd, wal*mart)') > 0;
    
    TEXT
    --------------------------------------------------------------------------------
    walmart
    wal mart
    
    SQL> select * from testcase where contains (text, 'ndata(nd, walmart)') > 0;
    
    TEXT
    --------------------------------------------------------------------------------
    walmart
    wal mart
    

    Published by: Roger Ford on 21 June 2012 10:22

  • Oracle Text - resulting from problem within cross Lexer (French/German)

    -Oracle DB Version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for Solaris: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

    -Test Table with data
    create table mytest (key primary number id, docs clob, lang VARCHAR2 (30));
    INSERT INTO VC_V7 VALUES (1, "I'm going to die ', 'french'");
    INSERT INTO VC_V7 VALUES (2, 'the dog is dead ',' french');
    INSERT INTO VC_V7 VALUES (3, "the dog was dead ',' french '");
    INSERT INTO VC_V7 VALUES (4, 'glad it is', 'french');
    INSERT INTO VC_V7 VALUES ("5, ' we are happy", "french");
    INSERT INTO VC_V7 VALUES (6, ' it's beautiful today "today ', 'french');
    INSERT INTO VC_V7 VALUES (' 7, ' red car ', 'German');
    INSERT INTO VC_V7 VALUES (' 8, ' Roter Zug ', 'German');
    INSERT INTO VC_V7 VALUES (9, ' Blau, Grün, rot, 'German');
    INSERT INTO VC_V7 VALUES (' 10, ' Ich bin danke ', 'German');
    commit;

    -Prepare cross Lexer
    Start
    ctx_ddl.create_preference ('english_lexer', 'basic_lexer');
    ctx_ddl.set_attribute ('english_lexer', 'mixed_case', 'no');
    ctx_ddl.set_attribute ('english_lexer', 'index_stems', 'ENGLISH');
    ctx_ddl.create_preference ('french_lexer', 'basic_lexer');
    ctx_ddl.set_attribute ('french_lexer', 'mixed_case', 'no');
    ctx_ddl.set_attribute ('french_lexer', 'base_letter', 'no');
    ctx_ddl.set_attribute ('french_lexer', 'index_stems', 'FRENCH');
    ctx_ddl.create_preference ('german_lexer', 'basic_lexer');
    ctx_ddl.set_attribute ('german_lexer', 'mixed_case', 'no');
    ctx_ddl.set_attribute ('german_lexer', 'base_letter', 'no');
    ctx_ddl.set_attribute ('german_lexer', 'composite', 'german');
    ctx_ddl.set_attribute ('german_lexer', 'alternate_spelling', 'german');
    ctx_ddl.set_attribute ('german_lexer', 'index_stems', 'GERMAN');

    ctx_ddl.create_preference ('global_lexer', 'multi_lexer');
    ctx_ddl.add_sub_lexer ('global_lexer', 'default', 'english_lexer');
    ctx_ddl.add_sub_lexer ('global_lexer', 'English', 'french_lexer', 'fre');
    ctx_ddl.add_sub_lexer ('global_lexer', 'german', 'german_lexer', 'pre');
    end;

    -Create Index
    Drop index myindex;
    create index myindex on mytest (docs)
    indexType is ctxsys.context
    settings)
    'COLUMN LANGUAGE LEXER global_lexer lang'
    );

    -Some queries

    1)
    SELECT SCORE (1), id, lang, docs
    OF mytest
    WHERE CONTAINS (docs, ' < query > < lang = "German" textquery > < /textquery > $rot < / query > ', 1) > 0;
    -> 3 lines (7, 8, 9)
    FIX. In the index table (DR$ MYINDEX$ I) there is an entry "BURP" with Type 9 and TokenCount 2...

    2)
    SELECT SCORE (1), id, lang, docs
    OF mytest
    WHERE CONTAINS (docs, ' < query > < lang = "German" textquery > < /textquery > $rote < / query > ', 1) > 0;
    -> 1 rank (7)
    INCORRECT - 8 and 9 must be returned as well. In the index table (DR$ MYINDEX$ I) there is an entry "BURP" with Type 9 and TokenCount 2...

    3)
    SELECT SCORE (1), id, lang, docs
    OF mytest
    WHERE CONTAINS (docs, ' < query > < lang = "french" textquery > < /textquery > $être < / query > ', 1) > 0;
    -> no line
    INCORRECT - 2, 3, 4 and 5 must be returned. In the index table (DR$ MYINDEX$ I) there is a 'BEING' with the Type 9 and TokenCount 4 entry...

    4)
    SELECT SCORE (1), id, lang, docs
    OF mytest
    WHERE CONTAINS (docs, ' < query > < lang = "french" textquery > < /textquery > $mourir < / query > ', 1) > 0;
    -> 1 line (1)
    INCORRECT - 2 3 ad must be returned as well. In the index (DR$ MYINDEX$ I) there is an entry "DIE" with the Type 9 and TokenCount 2...

    I could be missing something easy.

    Thanks for your help,

    Frédéric

    Please see my response combined in your other thread:

    Re: Replacement of text Oracle 11 - question of automatic Lexer, language detection, spelling

  • Oracle Text is searchable

    How to know the text search is enabled on my Oracle 10 or 11g? Our developers want to use the text feature, but the fact that we have very limited knowledge lead to this issue. Is it possible that I can query just for a parameter that will tell me that the Oracle database server is searchable text or text activate?

    Thank you!

    I have Server 64-bit Solaris 10 SARC.

    Two easy ways... first of all, make sure that the schema CTXSYS is installed.
    Select username from dba_users where username = 'CTXSYS.

    Second, to see if the script works:

    create table mytable (id number(9) primary key, mytext clob);
    insert into mytable values 1, 'oracle text test');
    create index myindex on mytable(mytext) indextype is ctxsys.context;
    select id from mytable where contains(mytext, 'oracle')> 0;
    
  • Big problem with Oracle Text

    Hi all
    I use the Oracle text to perform a full text search. I have my column indexed like that

    CREATE INDEX cm_property_text ON cm_property (text_value) INDEXTYPES IS CTXSYS. FRAMEWORK

    After that, I inserted a line in the text_value field have contain is: "I and you or other ', then run the synchronous command my index finger:

    Begin
    CTXSYS. CTX_DLL. SYNC_INDEX ('cm_property_text');
    end;

    Then I run the query to select out have the text_value line contains text value is "I and you".

    SELECT * FROM cm_property WHERE CONTAINS (text_value,' I / you "")

    But I got nothing. And I tried to change like this looking for text entry

    SELECT * FROM cm_property WHERE CONTAINS (text_value, ' I/you and/or other "" ");

    And I had a line that is the line that I inserted before.

    I have really no why? Who can help me to explain about this?

    Thank you very much!

    If you want to be able to search for empty words by default, you can use an empty stopwords list or which does not contain the words you want to search. For a single character escape, preface with-not. To escape a whole word or phrase, such as a keyword or reserved word, surround it with {}. Please see the demo below.

    SCOTT@orcl_11gR2> CREATE TABLE cm_property
      2    (text_value  VARCHAR2 (60))
      3  /
    
    Table created.
    
    SCOTT@orcl_11gR2> CREATE INDEX cm_property_text
      2  ON cm_property (text_value)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  PARAMETERS ('STOPLIST CTXSYS.EMPTY_STOPLIST')
      5  /
    
    Index created.
    
    SCOTT@orcl_11gR2> INSERT INTO cm_property (text_value)
      2  VALUES ('I and you or other')
      3  /
    
    1 row created.
    
    SCOTT@orcl_11gR2> Begin
      2    CTXSYS.CTX_DDL.SYNC_INDEX ('cm_property_text');
      3  end;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$cm_property_text$i
      2  /
    
    TOKEN_TEXT
    ----------------------------------------------------------------
    AND
    I
    OR
    OTHER
    YOU
    
    5 rows selected.
    
    SCOTT@orcl_11gR2> SELECT * FROM cm_property
      2  WHERE  CONTAINS (text_value, 'I {and} you') > 0
      3  /
    
    TEXT_VALUE
    ------------------------------------------------------------
    I and you or other
    
    1 row selected.
    
    SCOTT@orcl_11gR2> SELECT * FROM cm_property
      2  WHERE  CONTAINS (text_value, 'I {and} you {or} other') > 0
      3  /
    
    TEXT_VALUE
    ------------------------------------------------------------
    I and you or other
    
    1 row selected.
    
    SCOTT@orcl_11gR2>
    

Maybe you are looking for