Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update README with SDK changes and add pagination examples #822

Merged
merged 6 commits into from
Mar 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ import com.meilisearch.sdk.SearchRequest;

// ...

SearchResult results = index.search(
new SearchRequest("of")
.setShowMatchesPosition(true)
.setAttributesToHighlight(new String[]{"title"})
SearchResult results = (SearchResult) index.search(
new SearchRequest("of")
.setShowMatchesPosition(true)
.setAttributesToHighlight(new String[]{"title"})
);
System.out.println(results.getHits());
```
Expand Down Expand Up @@ -216,6 +216,38 @@ index.search(
"query": "wonder"
}
```
#### Custom Search With Pagination <!-- omit in toc -->

```java
import com.meilisearch.sdk.SearchResultPaginated;

// ...

SearchResultPaginated results = (SearchResultPaginated) index.search(
new SearchRequest("wonder")
.setPage(1)
.setHitsPerPage(20)
);
```

```json
{
"hits": [
{
"id": 2,
"title": "Wonder Woman",
"genres": ["Action","Adventure"]
}
],
"query": "wonder",
"processingTimeMs": 0,
"hitsPerPage": 20,
"page": 1,
"totalPages": 1,
"totalHits": 1
}
```

## 🛠 Customization

### JSON <!-- omit in toc -->
Expand Down