Reputation: 3415
I have a MarkLogic query written in XQuery and I would like to convert it to Java API using StructuredQueryBuilder
. Unfortunately, I can't find Java equivalent for cts:element-query
. Can you please show me how to implement it in Java?
The query that I want to convert:
cts:element-query(fn:QName("http://www.example.com/2009/pfi2","content"), cts:word-query("florists", ("case-insensitive","lang=en"), 4.5), ())
Upvotes: 1
Views: 328
Reputation: 7335
The StructuredQueryBuilder.containerQuery()
method constructs a search:container-query
in the Search API. On the enode, the REST API converts the search:container-query
to cts:element-query()
or cts:json-property-query()
or cts:json-property-scope-query()
as appropriate.
For more detail, see:
http://docs.marklogic.com/guide/search-dev/structured-query#id_87231
The other way to provide the query in the Java API is to serialize the cts:element-query()
as JSON or XML to learn the query structure and then use a DOM to construct the query and pass the query as a RawCtsQueryDefinition
payload.
For that approach, see:
http://docs.marklogic.com/guide/java/searches#id_45762
http://docs.marklogic.com/javadoc/client/com/marklogic/client/query/RawCtsQueryDefinition.html
Hoping that helps,
Upvotes: 1