Search part of text using Oracle TEXT SEARCH (CONTEXT index)

59 Views Asked by At

I am exploring Oracle Text (Context) index. I am able to search a full word.. How to search for a part of the text? Example, There is a text like "There is a HTTP POSTREQUEST" If i filter like below in my sql, I am not getting the result contains(text_col,'POST') > 0 or contains(text_col,'OSTREQ') > 0

-- I Understand Oracle Text is indexing the words.. Any way to search the part of the text?

Code sample for example

DROP TABLE test_context_tbl
;
CREATE TABLE test_context_tbl(no_col NUMBER, text_col VARCHAR2(1000))
;
INSERT INTO test_context_tbl VALUES (1,'There is a HTTP POSTREQUEST ')
;
COMMIT
;
CREATE INDEX ix_test_context ON test_context_tbl(text_col) INDEXTYPE IS ctxsys.CONTEXT
;
select * from test_context_tbl
where contains(text_col,'OSTREQ') > 0

    
1

There are 1 best solutions below

0
C Radhasankar On

I just found the answer.. using wildcard inside contains operator works

select * from test_context_tbl
where contains(text_col,'%OSTREQ%') > 0