How to return filtered result set in Marklogic?

erhangulsum

New Member
Consider the following xml:-\[code\]<?xml version="1.0"?><catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book></catalog>\[/code\]Now I want to run a search query against this document and want to return a filtered result set (e.g. author name). One way to do this is:-\[code\]xquery version "1.0-ml";import module namespace search="http://marklogic.com/appservices/search" at "/Marklogic/appservices/search/search.xqy";declare variable $options:=<options xmlns="http://marklogic.com/appservices/search"><transform-results apply="raw"/></options>;for $x in search:search("", $options)/search:resultreturn $x//author/text()\[/code\]But search:search API is first caching the whole result in its cache and then we are finding our desired node with xpath. I don't want this. I want search:search API to return only the desired element so that whole result set is not cached in marklogic server. Can anybody tell me please how can I achieve this in Marklogic ?
 
Back
Top