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

V2 Skip/Take on Umbraco V9 beta 3 #234

Closed
stuart-mullinger opened this issue Jun 5, 2021 · 3 comments
Closed

V2 Skip/Take on Umbraco V9 beta 3 #234

stuart-mullinger opened this issue Jun 5, 2021 · 3 comments

Comments

@stuart-mullinger
Copy link

Just upgraded to Umbraco V9 beta 3 and pleased to see the upgrade of Examine, so that we can now use skip and take to implement pagination on the search results. Unfortunately, it doesn't seem to be working. If I skip any number of records, then 0 are returned - even if there are valid records to return.

You can see the same problem in the Examine Management section in the back office.

  1. New install of Umbraco V9 beta 3.
  2. Create a document type (allowed as root).
  3. Create 21 pages under Content using that document type each with the same word in them (I used "page", e.g. "Page one", "Page two"...).
  4. Search for "page" in the ExternalIndex under Examine Management in Settings.
  5. First 20 pages are displayed, with 2 pages indicated.
  6. Click on page 2.
  7. No results are shown - I'd expect 1 more result to show on page 2.

Hopefully, this is the right place to raise this. Let me know if you need any further information.

@stuart-mullinger stuart-mullinger changed the title Skip/Take V2 Skip/Take on Umbraco V9 beta 3 Jun 5, 2021
@DavidArmitage
Copy link

Hi,

I can second this. I did some testing and encountered the same issues.

This was the code I was using.

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);

The search works when on page 1 but when I use page 2 or anything above no results are returned.
I can confirm all the other values such as the total results seems fine.

Regards

David

@DavidArmitage
Copy link

I also added the issue here where it might get picked up
umbraco/Umbraco-CMS#10463

Shazwazza added a commit that referenced this issue Jun 14, 2021
@Shazwazza
Copy link
Owner

Hi all,

Thanks for reporting. I've just merged dev to release/2.0 which contains some new unit tests for skip/take and that showed the issue. I have fixed this now and is in a version Examine 2.0.0-beta.152 release. It's available on MyGet here https://www.myget.org/F/umbracocore/api/v3/index.json. We'll need to update the CMS dependency too.

Does anyone have time to create a PR for the CMS to point at the new Examine version? IIRC there is 2 or 3 csproj to update.

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

No branches or pull requests

3 participants