Commit 8d237661 authored by Robert Knight's avatar Robert Knight

Remove obsolete references to `offset` query param

 - Remove unused references to `offset` search query param
 - Add JSDoc to clarify what the `searchAfter` param is
parent ae62cb39
...@@ -67,10 +67,12 @@ export default class SearchClient extends TinyEmitter { ...@@ -67,10 +67,12 @@ export default class SearchClient extends TinyEmitter {
} }
/** /**
* Fetch a batch of annotations starting from `offset`. * Fetch a batch of annotations.
* *
* @param {SearchQuery} query * @param {SearchQuery} query - Query params for /api/search call
* @param {string} [searchAfter] * @param {string} [searchAfter] - Cursor value to use when paginating
* through results. Omitted for the first page. See docs for `search_after`
* query param for /api/search API.
*/ */
async _getBatch(query, searchAfter) { async _getBatch(query, searchAfter) {
/** @type {SearchQuery} */ /** @type {SearchQuery} */
...@@ -129,7 +131,8 @@ export default class SearchClient extends TinyEmitter { ...@@ -129,7 +131,8 @@ export default class SearchClient extends TinyEmitter {
// If the current batch was full, there might be additional batches available. // If the current batch was full, there might be additional batches available.
const nextBatchAvailable = chunk.length === this._chunkSize; const nextBatchAvailable = chunk.length === this._chunkSize;
// Get the cursor for the start of the next batch. // Get the cursor for the start of the next batch. This is the last
// value for whatever field results are sorted by from the current batch.
const nextSearchAfter = const nextSearchAfter =
chunk.length > 0 ? chunk[chunk.length - 1][this._sortBy] : null; chunk.length > 0 ? chunk[chunk.length - 1][this._sortBy] : null;
......
...@@ -146,7 +146,6 @@ ...@@ -146,7 +146,6 @@
* *
* @typedef SearchQuery * @typedef SearchQuery
* @prop {number} [limit] * @prop {number} [limit]
* @prop {number} [offset]
* @prop {string[]} [uri] * @prop {string[]} [uri]
* @prop {string} [group] * @prop {string} [group]
* @prop {string} [order] * @prop {string} [order]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment