Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Facing problem with special characters in FTS.

Aksi kisuNov 16 2023 — edited Nov 16 2023

Hi.

I'm facing a real annoying problem with text search query, and everything I've tried failed.

I am trying to build a search functionality using FTS. Suppose if a user searches for ‘spec’, he/she should be able retrieve all documents that has either ‘spec’ or beyond ex ‘speci’,'speck' etc.

My query looks something like this select index from abc where contains(data,?,1) > 0 ps.setString('spec%',1);

The problem I am facing is when the user searches for keyword that contains some special keywords like !123A{}%4B it throws me

SQL Error [29902] [99999]: ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 13

and it does not throw error for all the special characters, may I know why only specific char and not all and how do I resolve it?
I have tried escaping them using {} and is does not work. Same with backslash \.
The only solution I was able think was to replace all the special char in my searchtext before setting it into the query, but as I am new to java has not idea how to do so.
Can anyone help me with this?

Thank you

Comments
Post Details
Added on Nov 16 2023
0 comments
290 views