November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
GetContentResult will simply load the content using GetItems, and I don't see any changes related to that in Find 14
How is IsExpired implemented?
Published is 4, CheckedIn = 3 and CheckedOut = 2 so if you order by Descending, I would say Published version will always be returned. You might want to sort by Ascending instead?
Even you simplify to this
_client.Search<Core.Models.Pages.AuthorPage>()
.Take(1000)
.GetContentResult()
.Where(x => x.ContentLink.ID == 123)
it returns only one result - the published version - even if there is a published version and a draft.
No it does not seem to be added to the index.
But as it used to be previously, there has been a change somewhere.
Is accesing the database directly the only way to go around this now?
No you don't have to use database directly. You either can include the draft in your index, or instead of GetContentResult, you call GetResult to get the content link only. then use IContentVersionRepository to load the versions of that content and pick the version you want to edit instead.
IIRC by default only the published versions are indexed. You can change your convention to include draft versions, but I don't think that is recommended.
This does not seam to be working : D
var tryingNew = _client.Search<Core.Models.Pages.AuthorPage>()
.Take(1000)
.GetResult()
.FirstOrDefault(x => x.ContentLink.ID == 117718);
var secondStep = _contentVersionRepository.List(tryingNew?.ContentLink);
BUT GetPagesResult() seems to be working. Any drawbacks that I should be aware of?
We have a job that finds a particular type of pages, updates and publishes them. If publishing fails a draft is saved.
This is our code to retrieve a page that needs to be updated
We were Ordering by status because we were getting both a published version and a draft; but if there was a draft we wanted to update this version and to try publish it.
And no matter how many times a job would fail to publish a page, it should try to update the same draft. That is how it worked in CMS 11.
Now in CMS 12 under some Author pages we are seeing a lot of drafts and have noticed that the same query even before the FirstOrDefault() already returns only one result - the published version (unless there is no published version and only a draft, then this one is returned). Then the job tries to update it but if it fails it creates a new draft, and the next time it fails it creates yet another draft and so on. Eventually when a page is published we end up with a lot of drafts.
Was there some kind of change in what Search method returns?
Is there an overload? Another method? How do we get the same result as before?