IPageRetriever where condition for unpublished changes

James de Boer asked on February 24, 2025 17:54

When using IPageRetriever it appears that a where condition is only taken into account on the published versions of a page, is that the expected behaviour?

var nodes = _pageRetriever.Retrieve(query => query .WhereEquals("AField", aValue) .LatestVersion(true) .Published(false)) .ToList();

is not picking up nodes where the unpublished version of AField is set to aValue.

Is the only option to get back all nodes and then filter in code?

Thanks

Correct Answer

Lukáš Gancarčík answered on February 25, 2025 10:13

Hi James,

Unfortunately this is caused by a current design - system executes the query and only after that - if you want latest data - it will "replace" the retrieved data with data from latest version. Therefore it is possible to filter latest data only after that (which is definitely not ideal) however this was changed in XbK.

Currently, you would indeed need to retrieve all nodes and then filter in code.

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.