Skip to content

Commit d8030c7

Browse files
authored
guidance of offset vs cursor
1 parent 40ffccb commit d8030c7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

rest_api.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- v30, 2016-09-26, Highlight issue tracker
3636
- v31, 2016-10-05, document `has-clinical-trial-number` and `has-abstract` filters
3737
- v32, 2016-10-27, document rate limit headers
38+
- v33, 2016-11-07, guidance on when to use `offset` vs `cursor`
3839

3940
## Background
4041

@@ -182,11 +183,12 @@ Parameters can be used to query, filter and control the results returned by the
182183
| `query` | limited [DisMax](https://wiki.apache.org/solr/DisMax) query terms |
183184
| `filter={filter_name}:{value}`| filter results by specific fields |
184185
| `rows={#}` | results per per page |
185-
| `offset={#}` | result offset |
186+
| `offset={#}` (mak 10k) | result offset (user `cursor` for larger `/works` result sets) |
186187
| `sample={#}` | return random N results |
187188
| `sort={#}` | sort results by a certain field |
188189
| `order={#}` | set the sort order to `asc` or `desc` |
189190
| `facet=t` | enable facet information in responses |
191+
| `cursor={#}` | deep page through `/works` result sets |
190192

191193
Multiple filters can be specified by separating name:value pairs with a comma:
192194

@@ -351,7 +353,7 @@ every time there is a change to metadata requiring a reindex.
351353

352354
## Result controls
353355

354-
You can control the delivery and selection results using the `rows`, `offset` and `sample` parameters.
356+
You can control the delivery and selection results using the `rows`, `offset` and `sample` parameters. If you are expecting results beyond 10K, then use a `cursor` to deep page through the results.
355357

356358
### Rows
357359

@@ -371,6 +373,8 @@ The number of returned items is controlled by the `rows` parameter, but you can
371373

372374
http://api.crossref.org/works?query=allen+renear&rows=5&offset=5
373375

376+
Offsets for `/works` are limited to 10K. Use `cursor` (see below) for larger `/works` results sets.
377+
374378
### Deep Paging with Cursors
375379

376380
Using large `offset` values can result in extremely long response times. Offsets in the 100,000s and beyond will likely cause a timeout before the API is able to respond. An alternative to paging through very large result sets (like a corpus used for text and data mining) it to use the API's exposure of Solr's deep paging cursors. Any combination of query, filters and facets may be used with deep paging cursors. While `rows` may be specified along with `cursor`, `offset` and `sample` cannot be used. To use deep paging make a query as normal, but include the `cursor` parameter with a value of `*`. In this example we will page through all `journal-article` works from member `311`:

0 commit comments

Comments
 (0)