I'm new to Oracle Text so please excuse the (probably) simple question. I want to be able to create a search that excludes (includes?) special characters and/or spaces between an abbreviated name. I'm not sure if it's possible but I would like to be able to return all of the below results if someone queried for "ABC" in one form or another.
Would this be something I'd add to a thesaurus? I see there is a STOPLIST but I'm not sure if there is the opposite of a stoplist.
Thanks in advance!
Regards,
Rich
set def off;
drop table docs;
CREATE TABLE docs (id NUMBER PRIMARY KEY, text VARCHAR2(200));
INSERT INTO docs VALUES(1, 'ABC are my favorite letters.');
INSERT INTO docs VALUES(2, 'My favorite letters are A,B,C');
INSERT INTO docs VALUES(3, 'The best letters are A.B.C.');
INSERT INTO docs VALUES(4, 'Three of the word letters are A-B-C.');
INSERT INTO docs VALUES(5, 'A B C are great letters.');
INSERT INTO docs VALUES(6, 'AB and C are easy letters to remember');
INSERT INTO docs VALUES(7, 'What if we used A, B, & C?');
commit;
begin
ctx_ddl.drop_preference('english_lexar');
end;
/
begin
ctx_ddl.create_preference('english_lexar', 'BASIC_LEXER');
ctx_ddl.set_attribute('english_lexar', 'printjoins', '_-');
ctx_ddl.set_attribute('english_lexar', 'skipjoins', '-.');
--ctx_ddl.set_attribute ( 'english_lexar', 'index_themes', 'YES');
ctx_ddl.set_attribute ( 'english_lexar', 'index_text', 'YES');
ctx_ddl.set_attribute ( 'english_lexar', 'index_stems', 'SPANISH');
ctx_ddl.set_attribute ( 'english_lexar', 'mixed_case', 'YES');
ctx_ddl.set_attribute ( 'english_lexar', 'base_letter', 'YES');
end;
/
begin
ctx_ddl.drop_preference('STEM_FUZZY_PREF');
end;
/
begin
ctx_ddl.create_preference('STEM_FUZZY_PREF', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_MATCH','ENGLISH');
ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_SCORE','0');
ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_NUMRESULTS','5000');
ctx_ddl.set_attribute('STEM_FUZZY_PREF','SUBSTRING_INDEX','TRUE');
ctx_ddl.set_attribute('STEM_FUZZY_PREF','PREFIX_INDEX','TRUE');
ctx_ddl.set_attribute('STEM_FUZZY_PREF','STEMMER','ENGLISH');
end;
/
begin
ctx_ddl.drop_preference('wildcard_pref');
end;
/
begin
Ctx_Ddl.create_Preference('wildcard_pref', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('wildcard_pref', 'wildcard_maxterms', 100) ;
end;
/
DROP index myindex;
create index myindex on docs (text)
indextype is ctxsys.context
parameters ( 'LEXER english_lexar Wordlist wildcard_pref' );
EXEC CTX_DDL.SYNC_INDEX('myindex', '2M');
SELECT SCORE(1), id, text FROM docs WHERE CONTAINS(text, 'ABC', 1) > 0;
It may be that my SQL statement isn't taking advantage of the Text options -- i.e. I'm forgetting something obvious :)