sqloracle11goracle10goracle-text

Oracle CONTAINS() not returning results for numbers


So I have this table with a full text indexed column "value". The field contains some number strings in it, which are correctly returned when i use a query like so:

select value
    from mytable 
    where value like '17946234';

Trouble is, it's incredibly slow because there are a lot of rows in this table, but when i use the CONTAINS operator I get no results:

select value
    from mytable
    where CONTAINS ( value, '17946234',1)>0

Anyone got any thoughts?

Unfortunately, I'm not an Oracle dude, and the same query works fine in SQL Server. I feel like it must be a stoplist or something with the Oracle Lexer that I can change, but not really sure how.


Solution

  • This could be due to INDEXTYPE IS CTXSYS.CONTEXT in general, or the index not having been updated after the looked for records where added (CONTEXT type indexes are not transactional, whilst CTXCAT type ones are).

    However, if you did not accidentally lose the wildcard in your statement (In other words: If no wildcard is required indeed.), you could just query

    select value from mytable where value = '17946234';
    

    which could possibly be backed by an ordinary index. (Depending on your specific data distribution and the queries run, an index might not help query performance.) Otherwise

    select value from mytable where instr(value, '17946234') > 0;
    

    might be sufficient.