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

Umbraco 9 Examine Query with QueryOptions not working #10463

Closed
DavidArmitage opened this issue Jun 14, 2021 · 2 comments
Closed

Umbraco 9 Examine Query with QueryOptions not working #10463

DavidArmitage opened this issue Jun 14, 2021 · 2 comments

Comments

@DavidArmitage
Copy link

Which Umbraco version are you using?

Umbraco version 9.0.0-beta003

Bug summary

When searching examine using QueryOptions there is a bug.

When you run search on page 1 it seems to work as expected.
When you run the same search on page 2 it brings back on results
When you run the same search on page 3 or above it brings back on results

Specifics

Relating to the code I have written below.

int pageIndex = blogSearch.CurrentPage - 1;
int pageSize = blogSearch.ItemsPerPage;

QueryOptions queryOptions = new QueryOptions(pageIndex * pageSize, blogSearch.ItemsPerPage);
ISearchResults searchResult = examineQuery.Execute(queryOptions);
IEnumerable pagedResults = searchResult;

int totalResults = Convert.ToInt32(searchResult.TotalItemCount);
blogSearch.TotalItems = totalResults;
blogSearch.TotalPages = (totalResults + blogSearch.ItemsPerPage - 1) / blogSearch.ItemsPerPage;
blogSearch.BlogDetailsPages = GetBlogArticlesFromSearch(pagedResults);

As I mentioned in the summary no data is returned when searching page 2 or above.
All other data like the TotalResults and TotalPages all seems correct

Steps to reproduce

Run any basic Examine search using QueryOptions.

Page 1 works but if you test searching page two no results will be retuned (in error)

QueryOptions queryOptions = new QueryOptions(pageIndex * pageSize, blogSearch.ItemsPerPage);
ISearchResults searchResult = examineQuery.Execute(queryOptions);

Expected result / actual result

Results should be returned for all pages in the search,

@Shazwazza
Copy link
Contributor

Is this just a duplicate of #10463 ?

@nul800sebastiaan
Copy link
Member

Duplicates Shazwazza/Examine#234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants