Oracle Database full text Search

68 Views Asked by At

I am Trying to run this Query

SELECT
    e.*,
    CONTAINS(fullname, ' ( ('|| 'SAHU*' ||') within PRIMARYID )  * 2 OR ( ('|| 'SAHU*' ||') within LASTNAME )  ',1)  AS match_score
FROM Employee e

I have created index for fullname and lastname still I am seeing this error

ORA-20000: Oracle Text error: DRG-10837: section lastname does not exist 20000. 00000 - "%s" *Cause: The stored procedure 'raise_application_error' was called which causes this error to be generated. *Action: Correct the problem as described in the error message or contact the application administrator or DBA for more information.

1

There are 1 best solutions below

0
On

From the docs:

"Use the WITHIN operator to narrow a query down into document sections"

A document needs to be sectioned in order to look within sections. Common examples are documents that are XML or JSON, and thus we can search within certain levels of the hierarchy.

We can't see your data, but if you just created an index on the concatention of some fiels, then that is not section, its just some strings, and can only be searched with a standard CONATAINS (without the WITHIN)