Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Strange result when using .Take ()

Vote:
0
			var items = Client.Search<FurnitureVariant>(requestLanguage)
                .Filter(x => x.GetMarkets().Match(market))
				.Filter(categoryFilter)
				.Filter(attributeFilter)
				.Filter(timelessItalianFilter)
				.Filter(x => x.LanguageBranch.MatchCaseInsensitive(language))
				.OrderBy(x => x.DisplayName);

 var itemsCount = items.Count();   // = 108

 // pageSize = 20   

 var itemResult = items
                .Skip((page - 1) * pageSize)
		.Take(pageSize)
		.GetContentResult();


  var itemResultsCount = itemResult.Count();  // = 17

If I set pageSize manually to 5, the result will be 2, so it is always wrong of 3. How do I solve this?

#201672
Feb 26, 2019 15:12
Vote:
0

Hi,

This is pretty weird, not something I've seem before.

You could try verifying whether GetResult() gives the correct number, GetContentResult() returns via the database (http://bergdaniel.se/episerver-find-getresult-getcontentresult) so if your index is out-of-date that could be the cause (alternatively you could try reindexing).

/Jake

#201743
Edited, Mar 01, 2019 2:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.