Text-Contains Clause (Reference)

A text-contains clause is operator $textContains with a string value that is used as a full-text search pattern: $textcontains:pattern. It matches a non-JSON document only if some text in the document matches that pattern. Matching is Oracle Text full-text matching.

(Operator $textContains is not supported by SODA for Java or SODA for REST.)

Oracle Text technology underlies SODA operator $textContains. This means, for instance, that you can query for text that is near some other text, or query use fuzzy pattern-matching. Operator $textContains acts like SQL function contains, and the syntax of the search-pattern is the same.

To use full-text search with $textContains you must first create an Oracle Text search index for the heterogeneous collection to be searched. (See Overview of QBE Operator $textContains for an example of how to do this.)

You can use a text-contains clause only in the outermost condition of a QBE, either in the sole top-level filter condition or in the sole condition in a query clause ($query). In either case, you can only use one text-contains clause in the condition.

Here is a typical filter condition containing a text-contains clause:

{ "$textContains" : "beth" }

You can use $textContains in conjunction with $id to search only particular documents. For example, these (equivalent) examples search the documents that have keys 1001, 1002, and 1003.

{ "$textContains" : "beth", "$id" : [1001,1002,1003] }
{ "$and" : [ { "$textContains" : "beth" }, { "$id" : [1001,1002,1003] } ] }

You cannot use a text-contains clause in conjunction with a clause other than ID. For example, this is not allowed:

{ "$textcontains" : "beth", "age" : 42 }
{ "$and" [ { "$textcontains" : "beth" },
             { "age" : 42 } ] }

See Also:

Related Topics