Hi, Rajesh: The default element for term specifies a default treatment for terms that aren't qualified by a constraint. The empty element specifies the treatment when the criteria consists of the empty string. Making a constraint mandatory in the criteria is a different requirement.
One solution would be to search in three steps: 1. Use search:parse() with "search:query" output to produce a search:query structure. 2. Use an XPath to check for the required constraint query in the structure and fail if not found. 3. Otherwise, use search:resolve-nodes() to execute the parsed query. To take this approach in the REST API, you could create a resource service extension. Hoping that's useful, Erik Hennum ________________________________ From: [email protected] [[email protected]] on behalf of Rajesh Kumar [[email protected]] Sent: Monday, February 18, 2013 5:39 AM To: [email protected] Subject: [MarkLogic Dev General] mandatory constraint in search:search Hi, How to make a constraint(“coll”) mandatory in search:options while performing search:search Ex: search:search("Book AND coll:abc",<options xmlns="http://marklogic.com/appservices/search"> <constraint name="coll"> <collection prefix="xxx"/> </constraint> </options> ) The above query should fetch me the results search:search("Book",<options xmlns="http://marklogic.com/appservices/search"> <constraint name="coll"> <collection prefix="xxx"/> </constraint> </options> ) This Query should return empty results. We tried using below code snippet but not working, Please suggest the soultion. <search:term apply="term"> <default ref="coll"/> <search:empty apply="no-results" /> </search:term> Thanks, Rajesh
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
