Reputation: 1510
I am Executing Following Java Code to Perform my Search Operation.
QueryManager queryManager = client.newQueryManager();
StructuredQueryBuilder builder = queryManager.newStructuredQueryBuilder();
StructuredQueryDefinition definition = builder.and(
builder.value(builder.element("filterField"), "abc"),
builder.range(builder.element("filterName"), "xs:string", Operator.EQ, "newfilter")
);
definition.setCollections(BaseDataConstants.FILTER_COLLECTIONS);
SearchHandle searchHandle = new SearchHandle();
queryManager.search(definition, searchHandle);
Requirement : I want to Print the Actual Search query fired against ML for Above java Code.
I don't know whether this is right question or not...but Please correct me if i am wrong.
Upvotes: 2
Views: 52
Reputation: 7335
To see the Search API query sent by the client, call the serialize() method, as in:
System.out.println(definition.serialize());
For more, see:
You can see the cts:query being executed by setting the return-query
query option to true. For more information, see:
http://docs.marklogic.com/guide/java/searches#id_76144
http://docs.marklogic.com/guide/search-dev/appendixa#id_60243
http://docs.marklogic.com/javadoc/client/com/marklogic/client/io/SearchHandle.html#getReports--
Hoping that helps,
Upvotes: 3