Solved

Oracle Text Contains Problem

Posted on 2009-06-30
3
572 Views
Last Modified: 2013-12-19
Hi Everyone,
I'm using the Oracle Text contains function, but it sometimes doesn't work properly.  It returns 0 (text not found) when the text is actually there.

For example:

select e.* , contains(e.emp_name, '%Jones%') as cont_val
from emp_table e
where e.emp_name = 'Jones'

Returns a row with cont_val = 0 (which means text not found).  Results for %Jones% in the contains function in the where clause return no rows.  This is a sporadic problem that only occurs for some rows in our table.  We're using Oracle 10.2.0.1.0.
Any ideas what's going on?
Thanks

0
Comment
Question by:leclaude
  • 2
3 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24828838
How are you updating your text indexes? They are not immediately synched and must be maintained, unlike regular indexes.

http://download.oracle.com/docs/cd/B15595_01/content.101/b14493/text.htm#sthref776

See the docs on ctx_ddl.sync_index() for manually synching, try a manual sync and see if it shows.

0
 
LVL 1

Author Comment

by:leclaude
ID: 24903920
Why would an index need to be synched to return a row? At worst the query should be slow, but not miss results.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24906622
That is how text indexes work. Text indexes are not standard Oracle b-tree indexes. The update does not happen immediately upon insert or update of the rows. Instead the change is scheduled, and will be applied when the next sync is run. In 10g and 11g I believe there is a setting that forces immediate update but it is poor for performance.

Please read this for an explanation:

http://www.oracle.com/technology/products/text/htdocs/Index_Maintenance.html
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious sideā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to recover a database from a user managed backup

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question