SearchDataSource MaxCount property doesn't limit results

Vote:
 

Just upgraded our system to 5 R2 sp1 and noticed that the results coming back from the code below is no longer limited by the 'MaxCount' property. I can constrain the results after I've got them but I'd rather not get all records in the first place for efficiency.

 public static PageDataCollection SearchPages(PageReference pageReference, string keyword, int MaxCount, int pageTypeId)
{
SearchDataSource searchDataSource = new SearchDataSource();
searchDataSource.PageLink = pageReference;
searchDataSource.SearchFiles = false;
searchDataSource.MaxCount = MaxCount;
searchDataSource.SortOrder = FilterSortOrder.PublishedDescending;

if (!String.IsNullOrEmpty(keyword))
searchDataSource.SearchQuery = keyword;

searchDataSource.Criteria.Add(new PropertyCriteriaControl()
{
Name = "PageStartPublish",
Type = PropertyDataType.Date,
Value = DateTime.Now.ToString(),
Condition = CompareCondition.LessThan,
Required = true
});

if (pageTypeId > 0)
{
searchDataSource.Criteria.Add(new PropertyCriteriaControl()
{
Name = "PageTypeID",
Type = PropertyDataType.PageType,
Value = pageTypeId.ToString(),
Condition = CompareCondition.Equal,
Required = true
});
}

return (PageDataCollection)searchDataSource.Select(DataSourceSelectArguments.Empty);
}


Thanks,

Jon 

#29526
May 01, 2009 17:41
* 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.