SearchHelper MaxResults

John Fu asked on September 30, 2015 08:39

Hi, was wondering if it's possible to increase the MaxResults returned by SearchHelper.Search().

The property SearchHelper.MaxResults is readonly. Is there some configuration in admin that can alter this?

Thanks.

Recent Answers


David te Kloese answered on September 30, 2015 15:05

Hi John,

Have you tried using the SearchParameters object (NumberOfResults property)?

SearchParameters parameters = new SearchParameters
            {
                SearchFor = keywords,
                SearchSort = null,
                Path = null,
                ClassNames = null,
                CurrentCulture = "##ALL##",
                DefaultCulture = null,
                CombineWithDefaultCulture = false,
                CheckPermissions = false,
                SearchInAttachments = false,
                User = MembershipContext.AuthenticatedUser,
                SearchIndexes = sii.IndexName,
                NumberOfResults = 100,
                AttachmentWhere = null,
                AttachmentOrderBy = null,
            };
            DataSet sr = SearchHelper.Search(parameters);

Good luck!

David

0 votesVote for this answer Mark as a Correct answer

John Fu answered on October 1, 2015 02:05

Hi, yes I have. And that doesn't seem to have any effect on the MaxResults returned.

Nevermind. I have got around the issue by filtering the list. I was trying to utilize the search index to pull in all the documents in 1 go instead of filtering the list. The original idea of pulling in everything was because the index was much more efficient compared to DocumentHelper.GetDocuments().

Thanks. John.

0 votesVote for this answer Mark as a Correct answer

Roel de Bruijn answered on October 1, 2015 09:55

Hi John,

Did you try to add the parameters NumberOfProcessedResults (performance) and DisplayResults as well?

0 votesVote for this answer Mark as a Correct answer

John Fu answered on October 1, 2015 10:01

Yep. I tried putting 10000 in both and it still only returned 1000 records.

0 votesVote for this answer Mark as a Correct answer

Roel de Bruijn answered on October 1, 2015 14:51 (last edited on October 1, 2015 14:51)

I had a quick look in the full source. Please add the following in the web.config, in the appSettings section:

<add key="CMSSearchMaxResultsNumber" value="10000"/>

1 votesVote for this answer Mark as a Correct answer

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