From 8f0b675e23a073be5555e14592071aecb46c5be4 Mon Sep 17 00:00:00 2001 From: Igal Levy Date: Thu, 6 Nov 2014 14:50:01 -0800 Subject: [PATCH] Added info to better explain how to use pagingSpec --- docs/content/SelectQuery.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/content/SelectQuery.md b/docs/content/SelectQuery.md index 9149358d605..aa475b2e5e7 100644 --- a/docs/content/SelectQuery.md +++ b/docs/content/SelectQuery.md @@ -28,7 +28,7 @@ There are several main parts to a select query: |filter|See [Filters](Filters.html)|no| |dimensions|The list of dimensions to select. If left empty, all dimensions are returned.|no| |metrics|The list of metrics to select. If left empty, all metrics are returned.|no| -|pagingSpec|A JSON object indicating offsets into different scanned segments. Select query results will return a pagingSpec that can be reused for pagination.|yes| +|pagingSpec|A JSON object indicating offsets into different scanned segments. Query results will return a `pagingIdentifiers` value that can be reused in the next query for pagination.|yes| |context|An additional JSON Object which can be used to specify certain flags.|no| The format of the result is: @@ -140,4 +140,30 @@ The format of the result is: } ] ``` -The result returns a global pagingSpec that can be reused for the next select query. The offset will need to be increased by 1 on the client side. \ No newline at end of file +The `threshold` determines how many hits are returned, with each hit indexed by an offset. + +The results above include: + +```json + "pagingIdentifiers" : { + "wikipedia_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9" : 4 + }, +``` + +This can be used with the next query's pagingSpec: + +```json + { + "queryType": "select", + "dataSource": "wikipedia", + "dimensions":[], + "metrics":[], + "granularity": "all", + "intervals": [ + "2013-01-01/2013-01-02" + ], + "pagingSpec":{"pagingIdentifiers": {"wikipedia_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9" : 5}, "threshold":5} + + } + +Note that in the second query, an offset is specified and that it is 1 greater than the largest offset found in the initial results. To return the next "page", this offset must be incremented by 1 with each new query. When an empty results set is recieved, the very last page has been returned.