Loading TOC...

cts:json-property-scope-query

cts:json-property-scope-query(
   $property-name as xs:string*,
   $query as cts:query
) as cts:json-property-scope-query

Summary

Returns a cts:query matching JSON properties by name with the content constrained by the given cts:query in the second parameter. Searches for matches in the specified property and all of its descendants.

Parameters
$property-name One or more property names to match. When multiple names are specified, the query matches if any name matches.
$query A query for the property to match. If a string is entered, the string is treated as a cts:word-query of the specified string.

Usage Notes

Enabling both the word position and element word position indexes will speed up query performance for many queries that use cts:json-property-scope-query. The position indexes enable MarkLogic Server to eliminate many false-positive results, which can reduce disk I/O and processing, thereby speeding the performance of many queries. The amount of benefit will vary depending on your data.

Example

(:
Given a database that has a JSON document as follows:
{"a":"aa","new":["array","content"],"b":["aa","bb"]}
:)
  cts:search(doc(),
    cts:json-property-scope-query(
      "a",
      "aa"))

  => .. relevance-ordered sequence of JSON documents (including
     the above document) with a property named "a" having a
     value of "aa".

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.