Hi, Sini: I neglected to mention a couple of points that might be useful.
The search response has a total attribute that provides the estimate. I assume you are writing XQuery in QueryConsole to prototype some client code. If that's not the case, you might consider stating the query in XML rather than in JSON to skip the transform step and thus simplify the processing. Erik Hennum ________________________________ From: [email protected] [[email protected]] on behalf of Erik Hennum [[email protected]] Sent: Thursday, March 21, 2013 7:37 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] search:estimate Hi, Sini: If you need to return all results, you could increase the page length in the query options to the largest number of results that you would reasonably want to return. Hoping that helps, Erik Hennum ________________________________ From: [email protected] [[email protected]] on behalf of sini narayanan [[email protected]] Sent: Thursday, March 21, 2013 7:20 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] search:estimate Hi All, I'm trying to get the total number of results returned after executing a query. The below code is working fine, but returns only 10 results (default page-length). But the total result count is 69. (:All the import statements are provided :) let $exportQuery := '{"query":{"and-query":{"queries":[{"range-constraint-query":{"constraint-name":"city","value":["Paris 01"]}}]}}}' let $options := xdmp:http-get("http://localhost:6024/v1/config/query/all", <options xmlns="xdmp:http"> <authentication method="digest"> <username>admin</username> <password>admin</password> </authentication> <format xmlns="xdmp:document-get">xml</format> </options>)//search:options let $query := json:transform-from-json($exportQuery,$sut:json-config-query) let $searchResults := search:resolve($query, $options) return $searchResults I was trying to use the "search:estimate" command to get the total count of results. But when I execute the command let $totalItems := search:estimate($query) (:$query being the same as above code:) it is throwing some exception. How do I use search:parse on this $query, which is transformed from json? I need the $totalItems to return 69. Any help on this regard would be helpful. Thanks, Sini
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
