Click here to Skip to main content
15,895,471 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to find a string "1-2050860-3" through CATSEARCH with 3 different query_string:
1. When I give :
select * from local_part_numbers lpn where catsearch(lpn.part_nbr,'2050860',null)>0;


it work fine.

2. When I give:
select * from local_part_numbers lpn where catsearch(lpn.part_nbr,'050860',null)>0;


it is not fetching any result although 050860 is present inside "1-2050860-3".

3. When I give:
select * from local_part_numbers lpn where catsearch(lpn.part_nbr,'*050860*',null)>0;


it is not fetching any result although 050860 is present inside "1-2050860-3".

The index creation code is as below:
begin
  ctx_ddl.drop_preference('CPRCTXCATSTORE');
  ctx_ddl.create_preference('CPRCTXCATSTORE', 'BASIC_STORAGE');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'I_TABLE_CLAUSE', 'tablespace CPR_TEXT_DATA_A');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'K_TABLE_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'R_TABLE_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'N_TABLE_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'S_TABLE_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');   
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'I_INDEX_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'P_TABLE_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');
  ctx_ddl.set_attribute('CPRCTXCATSTORE', 'I_ROWID_INDEX_CLAUSE', 'tablespace CPR_TEXT_INDEX_A');
 
  ctx_ddl.drop_preference('CPRCTXCAT_IDX_LEX');
  ctx_ddl.create_preference('CPRCTXCAT_IDX_LEX','BASIC_LEXER'); 
  ctx_ddl.set_attribute('CPRCTXCAT_IDX_LEX','SKIPJOINS','`=[];\,./~!@#$%^*()_+{}:"|<>?''');

  ctx_ddl.drop_preference('CPRCTXCAT_PARTNBR_IDX_WDL');
  ctx_ddl.create_preference('CPRCTXCAT_PARTNBR_IDX_WDL','BASIC_WORDLIST');
  ctx_ddl.set_attribute('CPRCTXCAT_PARTNBR_IDX_WDL','WILDCARD_MAXTERMS','50000');
  ctx_ddl.set_attribute('CPRCTXCAT_PARTNBR_IDX_WDL','PREFIX_INDEX','TRUE');
  ctx_ddl.set_attribute('CPRCTXCAT_PARTNBR_IDX_WDL','PREFIX_MIN_LENGTH',5);
  ctx_ddl.set_attribute('CPRCTXCAT_PARTNBR_IDX_WDL','PREFIX_MAX_LENGTH',40);
  ctx_ddl.set_attribute('CPRCTXCAT_PARTNBR_IDX_WDL','SUBSTRING_INDEX','TRUE');
end;


CREATE INDEX LPN_PARTNBR_IDX_CTXCAT on LOCAL_PART_NUMBERS(PART_NBR) INDEXTYPE IS CTXSYS.CTXCAT PARAMETERS ('STORAGE CPRCTXCATSTORE LEXER CPRCTXCAT_IDX_LEX WORDLIST CPRCTXCAT_PARTNBR_IDX_WDL');


Please help in this regard. i have similar problem for some other pattern also.

thanks,
naman
Posted

1 solution

CATSEARCH is a full text search which usually breaks up the text on spaces (or punctuation marks etc.)

Edit:
The Oracle documentation states that you can use * as a wildcard.

If the above does not work try a normal LIKE '%050860%'.
 
Share this answer
 
v2
Comments
namanD 16-Dec-14 11:16am    
It is not working!!
select * from local_part_numbers lpn where catsearch(lpn.part_nbr,'%050860%',null)>0;
it returns no rows as before.
Mehdi Gholam 16-Dec-14 11:31am    
My apologies, see the edited solution.
namanD 17-Dec-14 1:11am    
:) yes mehdi that will work....that is not the requirement here. I hope you have not got my question. My aim is to get the result only through Catsearch!!
DamithSL 16-Dec-14 11:37am    
what is the column data type of part_nbr?
namanD 17-Dec-14 1:18am    
Hey DamithSL...the data type is varchar2(40 char)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900