3

I have created basic search and uses the SearchHelper to get smart search results based on the search paramaters.

Now creating the Advance search based on Category , Author etc but did not find the way to filter the result based on these condition.

I am looking for a way to display the results using the dataset that

        // Prepare parameters
            SearchParameters parameters = new SearchParameters()
            {
                SearchFor = searchText,
                SearchSort = SearchHelper.GetSort(srt),
                Path = path,
                ClassNames = DocumentTypes,
                CurrentCulture = culture,
                DefaultCulture = defaultCulture,
                CombineWithDefaultCulture = CombineWithDefaultCulture,
                CheckPermissions = CheckPermissions,
                SearchInAttachments = SearchInAttachments,
                User = (UserInfo)CMSContext.CurrentUser,
                SearchIndexes = Indexes,
                StartingPosition = startPosition,
                DisplayResults = displayResults,
                NumberOfProcessedResults = numberOfProceeded,
                NumberOfResults = 0,
                AttachmentWhere = AttachmentsWhere,
                AttachmentOrderBy = AttachmentsOrderBy,
                BlockFieldOnlySearch = BlockFieldOnlySearch,
            };

            // Search
            DataSet results = SearchHelper.Search(parameters);
4

1 回答 1

2

The easiest way is to use the method:

SearchHelper.CombineSearchCondition()

The first parameter is the searchText, with the search terms you probably already have.

The second parameter is searchConditions, which can be formatted as per https://docs.kentico.com/k10/configuring-kentico/setting-up-search-on-your-website/smart-search-syntax

Alternatively you could just append your search conditions to your search text manually, separating each term with a space.

Remember that to filter based on any field they need to be selected as searchable in the SiteManager->Development->DocumentTypes->DocumentType->Search Tab.

于 2013-08-27T05:48:58.250 回答