Skip to content

Commit 649eb03

Browse files
author
Pieter Soudan
committed
add pagination section to readme
1 parent eed3e6c commit 649eb03

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,38 @@ Finally we can invoke search queries by invoking following API.
105105
PackageSearch.search("the text to search");
106106
```
107107

108+
### Pagination
109+
110+
You can provide options to limit your search query and implement pagination into your search: `skip` and `limit`. SearchSource will also sanitize your limiting options to only fetch data from you backend that is not already in history (that is, if you enabled local history caching by configuring a value for keepInHistory).
111+
112+
```js
113+
PackageSearch.search("the text to search", {
114+
skip: 0,
115+
limit: 12
116+
});
117+
```
118+
119+
For example, when you do the following subsequent searches with the same text string to seacrh for
120+
```js
121+
[
122+
{skip: 0, limit: 24},
123+
{skip: 0, limit: 36},
124+
{skip: 12, limit: 36},
125+
{skip: 24, limit: 24},
126+
];
127+
```
128+
129+
SearchSource will send the following requests on your backend (when keepInhistory is enabled):
130+
```js
131+
[
132+
{skip: 0, limit: 24},
133+
{skip: 24, limit: 12},
134+
{skip: 36, limit: 12}
135+
];
136+
```
137+
138+
To see an elaborate example on how to implement a paged search application, go to (http://infinitesearch.meteor.com).
139+
108140
### Status
109141

110142
You can get the status of the search source by invoking following API. It's reactive too.

0 commit comments

Comments
 (0)