Hi, Vinod:

It's not an error to request more documents than exist.

Thus, in principle, you don't need to know in advance how many results exist.  
Theoretically, you could set the pageLength to the largest unsigned long to 
return a single response with as many results as possible.

In practice, that will fail for any significant result set.  Geert's 
recommendation will scale and perform much better.


Erik Hennum

________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Geert Josten 
[geert.jos...@marklogic.com]
Sent: Friday, January 09, 2015 1:02 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] How to get all result in single hit 
through REST API

Hi Vinod,

If you have too many results, you will choke your systems. Consider requesting 
multiple pages (with a pageLength of 100 for instance) (sequentially or maybe 
even in parallel) until you have gathered all results. Allowing to batch up the 
content will make your solution scale much better..

Kind regards,
Geert

From: David Ennis <david.en...@hinttech.com<mailto:david.en...@hinttech.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Friday, January 9, 2015 at 9:04 AM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: Re: [MarkLogic Dev General] How to get all result in single hit 
through REST API

HI.

You could do one call with the pageLength set to zero. I believe this will 
still give you the total count of all records in the result -but no data.

Then you could use that value to use for pageLenght.

Not sure if there is a hard-coded max somewhere in the REST code. that would be 
the only hiccup, I believe.



Kind Regards,
David Ennis


David Ennis
Content Engineer

[HintTech] <http://www.hinttech.com/>
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[http://www.hinttech.com]<http://www.hinttech.com> [X] 
<https://twitter.com/HintTech>  [X] <http://www.facebook.com/HintTech>  [X] 
<http://www.linkedin.com/company/HintTech>

On 9 January 2015 at 08:54, 
<thangella.vinodre...@cognizant.com<mailto:thangella.vinodre...@cognizant.com>> 
wrote:
Hi,

Mark Logic search REST API  by default returns 10 records per hit. We know that 
there is an attribute called “pageLength” to return the no of results to which 
it is set.

But we want to return all documents from MarkLogic database without knowing its 
count. It’s not recommended to get all result in a single shot but currently 
our requirement is like that only.

So, Is there any parametric value we have to pass in REST API search URL or any 
other way? Please suggest.


Regards,
Vinod Reddy.
+91-9490342007<tel:%2B91-9490342007>

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to