Kentico 13 SeachHelper.Search NumberOfProcessedResult limit

Mark Herbert Belderol asked on April 6, 2023 11:00

Hi everyone! I'm pretty new with Kentico. I'm using kentico 13 refresh 13.0.95 right now.

Just wanted to ask if there is a certain limitation to the NumberOfProcessedResult in SearchHelper.Search method? I tried hard to look for it but I can't find any documentation that points me to it.

I did try to find it out by trial and error in my code and found out that the NumberOfProcessedResult is limited up to 1000 items only, if the search index contains more than that the Search method will not process it. Is this a limitation of the Search method itself or a license limitation?

Any answer is greatly appreciated.

Correct Answer

Ömer Karagülmez answered on April 10, 2023 14:05

Hello Mark,

There is a property called "NumberOfProcessedResults" in "SearchParameters" type.

You could try below code snippet.

// Gets the search index
SearchIndexInfo index = SearchIndexInfoProvider.GetSearchIndexInfo("NewIndex");

if (index != null)
{
    // Prepares the search parameters
    SearchParameters parameters = new SearchParameters()
    {
        SearchFor = "home",
        SearchSort = "##SCORE##",
        Path = "/%",
        CurrentCulture = "EN-US",
        DefaultCulture = CultureHelper.EnglishCulture.IetfLanguageTag,
        CombineWithDefaultCulture = false,
        CheckPermissions = false,
        SearchInAttachments = false,
        User = (UserInfo)MembershipContext.AuthenticatedUser,
        SearchIndexes = index.IndexName,
        StartingPosition = 0,
        DisplayResults = 100,
        NumberOfProcessedResults = 100, //Change this value
        NumberOfResults = 0,
        AttachmentWhere = String.Empty,
        AttachmentOrderBy = String.Empty,
        ClassNames = ""
        /* The 'SearchParameters.ClassNames' property only limits the attachment search,
        not the results of the basic SearchHelper.Search method. You can limit class names (page types)
        by adding a Lucene search condition to the text of the 'SearchFor' query. */
    };

    // Performs the search and returns the matching results as a SearchResult object
    SearchResult results = SearchHelper.Search(parameters);

    // Processes the search result items from the SearchResult
    foreach (SearchResultItem resultItem in results.Items)
    {
        /* Access the values of search results via the properties of the SearchResultItem class,
        for example Title, Content, Score, etc. */
    }
}

And related document is https://docs.xperience.io/13api/configuration/smart-search

Regards.

0 votesVote for this answer Unmark Correct answer

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