Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Name search with ndata not returning all matched rows

Sanjeev ChauhanMay 30 2017 — edited May 30 2017

I am trying to do name search (LATIN characters only), with field like email, phone, street, city, zip, incomplete birthdays (yyyy,mm,dd), to refine the match. To this end, I am following the "more complicated version" of the example provided here, https://docs.oracle.com/database/122/CCAPP/using-oracle-text-name-search.htm#CCAPP9536. I also created a nicknames thesaurus and uploaded the nicknames file, $ORACLE_HOME/ctx/sample/thes/dr0thsnames.txt. Next I inserted a new row into emp.

insert into emp values

('Lisa', 'Ann', 'Marie', 'lisa.ann.marie@example.org', '555-456-7890');

commit;

In the example the same bind variable, :name, is used for phone, email, and name. Shouldn't it be different variables. Anyway, I modified the query like this

select :phone, :email, :name, first_name, middle_name, last_name, phone, email, scr

from

(select /*+ FIRST_ROWS */

      first\_name, middle\_name, last\_name, phone, email, score(1) scr

from emp

where contains(first\_name,

      'ndata(phone, '||**:phone**||') **accum**  ndata(email,'||**:email**||') **accum**

       ndata(fullname, '||**:name**||') ',1) > 0

order by score(1) desc

)

where rownum <= 10;

using

phone=9999999999

email=@example.org

name=james

pastedImage_6.png

james has nicknames, {JAMES}|{JAMIE}|{JIM}. So, John's record should not get matched. If the record was matched because of '@example.org', then both rows should have been matched. Why did the query not match Lisa's record.

Also,

  1. Is NDATA suitable for email, phone, street, city, zip, yyyy, mm, dd column or is SDATA with normal or bitmap index a better option?
  2. How would I use wild cards (LIKE, %, +, -, *) in the search parameter with NDATA. Should I be using prefix index in basic_wordlist preference?
  3. ctx_thes.create_relation documentation states, "The synonym ring is limited in length to about 4000 synonyms, depending on word length.". What is a synonym ring. What has word length got to do with synonyms? Is the thesaurus limited to only 4000 phrases or 4000 synonyms per phrase.
  4. Can someone point to me to a good resource for NDATA and thesaurus. I found Robert Ford's blog, https://blogs.oracle.com/searchtech/indexing-data-from-multiple-tables-with-oracle-text , but the links to the scripts are dead.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 27 2017
Added on May 30 2017
2 comments
545 views