You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
579: Update search docs r=ahmednfwela a=danFbach
# Pull Request
## Related issue
Fixes#577, references #578
## What does this PR do?
- Updates docs to better reflect how results can be consumed.
- Some of the existing docs are wrong as `SearchResult<T> result = await index.SearchAsync(...);` is actually invalid since an explicit cast is required from `ISearchable<T>` to the type of result.
- There was no context showing that the result should be cast to either `SearchResult<T>` or `PaginatedResult<T>` in order to populate properties `EstimatedTotalHits` or `TotalHits` and `TotalPages` respectively.
## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?
If you have any critiques or anything you want added to the docs for this purpose, let me know. Just hoping to clarify how transform the interface correctly.
Technically the proper type could be derive by one of two methods:
```c#
var result = (SearchResult<T>)await index.SearchAsync<T>(...);
```
or
```c#
var result = await index.SearchAsync<T>(...);
if (result is SearchResult<T> searchResult)
{
//...
}
```
I prefer the latter, so that's how i changed the docs.
Co-authored-by: Dan Fehrenbach <[email protected]>
Co-authored-by: Clémentine <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+37-2Lines changed: 37 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,7 +146,7 @@ JSON Output:
146
146
All the supported options are described in the [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters) section of the documentation.
You can paginate search results by making queries combining both [offset](https://www.meilisearch.com/docs/reference/api/search#offset) and [limit](https://www.meilisearch.com/docs/reference/api/search#limit).
#### Search with defined number of results per page
246
+
247
+
To get paginated results with page numbers, the [HitsPerPage](https://www.meilisearch.com/docs/reference/api/search#number-of-results-per-page) and [Page](https://www.meilisearch.com/docs/reference/api/search#page) properties must be defined.
if (resultsisPaginatedSearchResult<T> paginatedResults)
257
+
{
258
+
vartotalHits=paginatedResults.TotalHits;
259
+
vartotalPages=paginatedResults.TotalPages;
260
+
}
261
+
```
262
+
228
263
## 🤖 Compatibility with Meilisearch
229
264
230
265
This package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-dotnet/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.
0 commit comments