-
Notifications
You must be signed in to change notification settings - Fork 58
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
fix for #577 #578
fix for #577 #578
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
I think I would retract this PR. There should probably be separate interfaces for offset and paginated results. This would better conform with API result object, which is polymorphic based on the request. Is this more what you all would be looking for? |
The way you have it looks completely fine to me: |
@migueltarga The problem is that they already have both For paginated results. var results = await index.SearchAsync<MeilisearchResultProductModel>(query, new SearchQuery()
{
ShowRankingScore = true,
Page = page,
HitsPerPage = pageSize,
Filter = buildFilter(categoryIds, manufacturerId, currentStoreId),
});
if (results is PaginatedSearchResult<MeilisearchResultProductModel> paginatedResult)
{
var totalPages = paginatedResult.TotalPages
} Or for offset style request: if (results is SearchResult<MeilisearchResultProductModel> searchResult)
{
var totalHits = searchResult.EstimatedTotalHits;
} Will be testing this shortly and will report if it works as expected. |
@migueltarga I can confirm that the following syntax is valid. var results = await index.SearchAsync<T>(query, new SearchQuery()
{
Limit = 5,
Offset = 0,
ShowRankingScore = true
});
if (results is SearchResult<T> resultModel)
{
var estimatedTotalHits = resultModel.EstimatedTotalHits;
} Docs should probably be updated to make this more obvious. |
@danFbach Thank you for the explanation and the example! |
Pull Request
Related issue
Fixes #577
What does this PR do?
Offset
,Limit
andEstimatedTotalHits
fields toISearchable<T>
SearchResult<T>
now use/// <inheritdoc/>
as docs were also moved toISearchable<T>
PR checklist
Please check if your PR fulfills the following requirements:
Not sure if
Offset
andLimit
also need to ported up, but i could envision a scenario where it would be useful, so I brought them along too.