Pradeep, You might also want to check your Search API configuration with the check-options function <http://developer.marklogic.com/pubs/4.1/apidocs/SearchAPI.html#search:check-options>. This function validates your options node and reports back errors. Note that unlike the rest of the Search API, this function is designed solely for debugging while developing search applications and should not be used in production.
Justin Justin Makeig Product Manager Mark Logic Corporation 999 Skyway Road Suite 200 San Carlos, CA 94070 +1 650 655 2387 Phone [email protected]<mailto:[email protected]> www.marklogic.com<http://www.marklogic.com/> <http://www.marklogic.com/><http://www.marklogic.com/> This e-mail and any accompanying attachments are confidential. The information is intended solely for the use of the individual to whom it is addressed. Any review, disclosure, copying, distribution, or use of this e-mail communication by others is strictly prohibited. If you are not the intended recipient, please notify us immediately by returning this message to the sender and delete all copies. Thank you for your cooperation. On Apr 26, 2010, at 11:35 AM, Mark Helmstetter wrote: I think that the problem is that within your <options> element, you're using a default namespace ("http://marklogic.com/appservices/search"), which is the namespace that's in scope within that expression. Probably the easiest solution is put the <facets> element in that same namespace (currently it's in the "empty" namespace): let $node := <facets xmlns="http://marklogic.com/appservices/search"> <facet-element> <facet-name datatype="xs:string">title</facet-name> <element ns="http://marklogic.com/ls" name="title"/> </facet-element> </facets> let $options := <options xmlns="http://marklogic.com/appservices/search"> { for $i in $node/facet-element return <constraint name="{$i/facet-name}" facet="true" > <range collation="http://marklogic.com/collation/" type="{$i/facet-name/@datatype}"> <facet-option>limit=10</facet-option> {$i/element} </range> </constraint> } <return-results>true</return-results> <return-facets>true</return-facets> </options> return $options Or you could explicitly declare the search namespace you are using, and explicitly use that namespace rather than using a default namespace: declare namespace search="http://marklogic.com/appservices/search"; let $node := <facets> <facet-element> <facet-name datatype="xs:string">title</facet-name> <element ns="http://marklogic.com/ls" name="title"/> </facet-element> </facets> let $options := <search:options > { for $i in $node/facet-element return <search:constraint name="{$i/facet-name}" facet="true" > <search:range collation="http://marklogic.com/collation/" type="{$i/facet-name/@datatype}"> <search:facet-option>limit=10</search:facet-option> {$i/element} </search:range> </search:constraint> } <search:return-results>true</search:return-results> <search:return-facets>true</search:return-facets> </search:options> return $options -----Original Message----- From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Pradeep Maddireddy Sent: Monday, April 26, 2010 11:59 AM To: General Subject: [MarkLogic Dev General] Query Help Hi..! Can some one tell me why this query is failing ------------------------------------------------------------------------------------------------------ let $node := <facets> <facet-element> <facet-name datatype="xs:string">title</facet-name> <element ns="http://marklogic.com/ls" name="title"/> </facet-element> </facets> let $options := <options xmlns="http://marklogic.com/appservices/search"> { for $i in $node/facet-element return <constraint name="{$i/facet-name}" facet="true" > <range collation="http://marklogic.com/collation/" type="{$i/facet-name/@datatype}"> <facet-option>limit=10</facet-option> {$i/element} </range> </constraint> } <return-results>true</return-results> <return-facets>true</return-facets> </options> return $options ------------------------------------------------------------------------------------------------------ When I remove the namespace declaration "xmlns="http://marklogic.com/appservices/search"" from the options node I get the desired result, but when I have the namespace the query fails. Thanks Pradeep Maddireddy _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
