When using the wildcard character in combination with a dot in a text search, my query does not find the matching row.
For example:
CREATE TABLE MY_TABLE( ITEM_NUMBER VARCHAR2(50 BYTE) NOT NULL);
INSERT INTO MY_TABLE (ITEM_NUMBER) VALUES ('1234.1234');
create index TIX_ITEMNO on MY_TABLE(ITEM_NUMBER) indextype is ctxsys.context;
I want to find the row in MY_TABLE where ITEM_NUMBER column is '1234.1234'
This does find the row:
SELECT * FROM MY_TABLE
WHERE CONTAINS(ITEM_NUMBER, '%1234') > 0
This does not find the row:
SELECT * FROM MY_TABLE
WHERE CONTAINS(ITEM_NUMBER, '%.1234') > 0
I do not understand why, since according to Oracle the dot is not a special character that has to be escaped.
How do I have to handle this situation?
This is because your default lexer is treating the period as a word separator.
Initial setup:
This gets the behaviour you see:
If you add a lexer that defines
PRINTJOINS
to include the period:then it behaves the way you want:
Read more about text indexing elements.
I think you wanted