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

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,
- Is NDATA suitable for email, phone, street, city, zip, yyyy, mm, dd column or is SDATA with normal or bitmap index a better option?
- How would I use wild cards (LIKE, %, +, -, *) in the search parameter with NDATA. Should I be using prefix index in basic_wordlist preference?
- 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.
- 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