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

V9 Examine Examine examineQuery.Execute(queryOptions) Not Working #10462

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

V9 Examine Examine examineQuery.Execute(queryOptions) Not Working #10462

DavidArmitage opened this issue Jun 14, 2021 · 13 comments

Comments

@DavidArmitage
Copy link

Which Umbraco version are you using?

Umbraco version 9.0.0-beta003

Bug summary

There is a bug with the Examine Query.
It seems to only return data for the first page. Page 2 or anything about never seems to bring back any data.

Specifics

Here is the code I am using to query examine.

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

//###This should be the correct way to do this but there is still a bug with the umbraco core code.
//###For some reason it only brings back results for the first page and nothing above
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);

This seems to work fine just for the first page but if you pass in page 2 or anything above in with the QueryOptions then no results get returned.

I can confirm all the other data seems correct such as the total results, number of pages etc.
It just doesn't seem to be returning the correct results.

Steps to reproduce

Run a Examine query using QueryOptions.

If you test on page one it works.
If you test on page 2 no results are returned
If you test on any page about page 2 no results are retuned.

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

Expected result / actual result

Results should be returned for each page.

@Shazwazza
Copy link
Contributor

FIxed here Shazwazza/Examine#234 but the CMS needs to be updated to point to the new Examine version. That should be a very good/easy PR to make if anyone in the community has time?

@umbrabot
Copy link

Hi @DavidArmitage,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@DavidArmitage
Copy link
Author

Hi @Shazwazza @nul800sebastiaan

I am happy to take this task on.
This would be by first PR however.

I am been looking to get involved with contributing and this might be a great starting point.

Can one of you give me a few pointers how to get up and running.
What Git Repositories should I be cloning to get started and what needs merging in exactly?

This task might take a bit more time getting me up and running but I plan to be regularly contributing to other stuff. If anyone can help get me up and running that would be amazing.

Regards

David

@vlaellayug
Copy link
Contributor

vlaellayug commented Jun 15, 2021

Hello @DavidArmitage,

I'm on my way to update the Examine version but a notification popped up on the current tab. Happy to help with your first contribution!

examine

This documentation helped me a lot. https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/.github/CONTRIBUTING.md

Steps that might help you get it up and running:
• Fork the Umbraco-CMS then clone it on your local machine
• Checkout the v9/dev branch
• Build the project to ensure if there are some dependencies you need to resolve, once success
• Go to Umbraco.Web.UI.NetCore instance
• Run dotnet build then dotnet run
• Install Umbraco

Steps for contributing:
• Branch out from v9/dev as "temp-10462"(followed the naming convention on the documentation)
• Commit and push your updates
• Submit the pull request

@DavidArmitage
Copy link
Author

Great. Thanks. I will take a look and try and get up and running.
I already had a quick look but got build errors in powershell.

I will have a better look tomorrow when I have more time on my hands.

@nul800sebastiaan
Copy link
Member

nul800sebastiaan commented Jun 15, 2021

Just so you know what we are going to expect: the relevant package.config (I see we don't use nuget package.config files any more on v8) and .csproj files contain the new Examine version and the NuSpec needs to be updated: https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/build/NuSpecs/UmbracoCms.Web.nuspec#L31

@nul800sebastiaan
Copy link
Member

Oh, don't mind me, forgot this was for v9! 😅 So once you get it up and running, update the Examine NuGet package in the projects it's currently installed in, don't think we need more than that.

@DavidArmitage
Copy link
Author

@nul800sebastiaan @vlaellayug

I managed to fork and cone down V9. I checked out the V9/dev branch.

I was able to build using gulp as described here (no errors here).
https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/.github/CONTRIBUTING.md

I was also able to build using Visual Studio (no errors here).

When I run the project for the first time I am getting errors.
_hostingSettings = hostingSettings.Value ?? throw new ArgumentNullException(nameof(hostingSettings));
System.ArgumentNullException: 'Value cannot be null.
Parameter name: hostingSettings'

Did you guys get this error with your first build / run?

Any ideas?

screen_shot

@vlaellayug
Copy link
Contributor

vlaellayug commented Jun 16, 2021

Hello @DavidArmitage,

May I ask what instance are you using to run it?

I think on V8 we're certainly looking into Umbraco.Web.UI instance,

As for Umbraco 9 haven't really look and play around with Umbraco.Web.UI. What I've noticed is when I tried the beta release, it has the same structure as Umbraco.Web.UI.NetCore instance then dotnet build and dotnet run got me running.

@nul800sebastiaan
Copy link
Member

It kinda looks like you're on the v8 branch @DavidArmitage, I would recommend you delete your local clone, clone it again and then switch to v9/dev. That should give you a nice and clean folder to work with. If you already have v8 temp files laying around it might not clean up so nicely when switching from the v8 to the v9 branch 😄

@nul800sebastiaan
Copy link
Member

Ah, actually, no, just saw the file explorer on your screenshot, looks like v9!

@vlaellayug is right, you need to change the startup project to Umbraco.Web.UI.NetCore 👍

@DavidArmitage
Copy link
Author

Thanks Guys. It looks like I am up and running now.
I will figure out what needs fixing then move on to figuring out the PR.

@nul800sebastiaan
Copy link
Member

Ah I see this one is still open, the CMS was later updated to the latest version (beta-154), so I'll close this issue!

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

6 participants