Forum Stats

  • 3,839,037 Users
  • 2,262,441 Discussions


Using Oracle Text's ndata and sdata operators with JSON

Sanjeev Chauhan
Sanjeev Chauhan Member Posts: 138 Blue Ribbon

Database version

I have used Oracle Text's ndata and sdata operators on XML documents. Because JSON does not have beginning and ending tags in the format <A>value</A>, will the JSON key be used as tags. I could define my preference and then create a ctxsys.context index on a JSON doc, but I get no results when I use the ndata operator. I know the tags in XML and keys in JSON are case sensitive, but that did not help. So, I am wondering if these operators can work with JSON documents. Could you please point me to the relevant Oracle doc where ndata + JSON is discussed.

For XML documents with data like, <FIRST_NAME>John Doe</FIRST_NAME>, I can add a ndata section like this, ctx_ddl.add_ndata_section('my_sg', 'first_name', 'first_name'); and then query it like this where contains(<table_column>,'ndata(FIRST_NAME,john doe)',1) > 0 . I am hoping to do something similar with JSON.

Also, how can I preserve case when adding a section group? ctx_ddl.ctx_ddl.add_ndata_section always changes to uppercase.