Reputation: 745
I’m using the Java API (although I don't think it's relevant) to run searches against Marklogic and I’d like to pull back some information from the document and from the document’s properties in the results. I’m able to pull back data from the document itself by using the extract-document-data element of the options but I can’t seem to figure out how to also pull back properties.
I’ve tried a couple different things for what I specify in the extract-path element but I can’t get to the properties.
<options xmlns="http://marklogic.com/appservices/search">
<extract-document-data selected="include">
<extract-path>/some/path</extract-path><!--This works-->
<!--These Do Not -->
<extract-path>/property::propName</extract-path>
<extract-path xmlns:prop="http://marklogic.com/xdmp/property">/prop:properties/ propName </extract-path>
</extract-document-data>
<search-option>filtered</search-option>
</options>
How can I pull back information from the document properties while searching?
Upvotes: 1
Views: 33
Reputation: 7770
To get a document or related information (metadata, collections, properties), I would actually hit the documents API and gather what is needed. You can retrieve the URIs from the search results you have or could query them through another endpoint, I believe.
If you are considering using the Search endpoint and want to bring back the properties, ect., I believe that you would accomplish that via a transform function. For this, just remember to keep your code as lightweight as possible since it will be run against every document being returned.
Upvotes: 1