Full Transcript

Search pipeline Suggest Edits Note By default, Configured Commerce uses Elasticsearch version 5.5 (Nest5) for search functionality on customer storefronts. The following search pipelines are applicable only for Elasticsearch version 5.5 (Nest5), if you are upgrading to or on Elasticsearc...

Search pipeline Suggest Edits Note By default, Configured Commerce uses Elasticsearch version 5.5 (Nest5) for search functionality on customer storefronts. The following search pipelines are applicable only for Elasticsearch version 5.5 (Nest5), if you are upgrading to or on Elasticsearch version 7.10 (Nest7), refer Third party search pipelines. CategoryIndexerPipeline CreateElasticsearchCategory O r d Pipe Description e r 1 Create a new ElasticsearchCategory object CreateElasticsear 0 using the parameter object's fields and assigns chCategory 0 it to result.ElasticsearchCategory. GetIndexableCategories O r d Pipe Description e r 1 Creates an Entity Framework Category query GetIndexableCateg 0 using the parameter object's fields and oriesQuery 0 assigns it to result.IndexableCategories. MapElasticSearchCategoryProperty O r d Pipe Description e r If the 1 MapElasticSearchCategoryCus parameter.SearchBoost.IsQuerya 0 tomProperties ble is true and 0 parameter.PropertyDefinition.IsC ustomProperty is true sets result.Property to a new Nest TextProperty. CategorySearchPipeline RunCategorySearch O r d Pipe Description e r Retrieves the current SiteContext, 1 InitializeSearchP ElasticsearchIndex and 0 roperties ElasticsearchQueryBuilder and assigns them to 0 the result object. 2 Retrieves SearchGeneralSettings and 0 GetSettings FuzzySearchSettings and assigns them to the 0 result object. 3 Assigns the result.CategorySearchFields object 0 GetQueryFields with the fields that are queryable. 0 4 Assigns result.StartRow and result.PageSize 0 FormPaging from the parameter object. 0 Finds the disallowed categories for the current 5 FormCategoryEx user (using the FormProductFilter pipeline) and 0 cludeList caches this value. The value is then assigned to 0 result.DisallowedCategories. If there are any disallowedCategories adds a new 6 FormCategoryEx negated Terms query to result.AllFilters using 0 cludeFilter result.DisallowedCategories on the categoryId 0 field. 7 Adds a new MatchQuery using the FormLanguageFi 0 result.SiteContext.LanguageDto.LanguageCode lter 0 on the languageCode field to result.AllFilters. 8 Adds a new MatchQuery using the FormWebsiteFilt 0 result.SiteContext.WebsiteDto.Id on the er 0 websiteId field to result.AllFilters. 9 Creates a BooleanQuery (AND) of all filters in 0 CombineFilters result.AllFilters and assigns it to 0 result.CombinedFilter. Creates a MultiMatchQuery of type CrossFields using parameter.Criteria and result.CategorySearchFields and apply boosts. 1 0 FormMainSearc Creates a MultimatchQuery of type PhrasePrefix 0 hQuery using parameter.Criteria and 0 result.CategorySearchFields and apply boosts. Adds both of these queries to result.AllQueries. If fuzzy search is enabled, creates a MultiMatchQuery with fuzziness set to 1 FuzzySearchSettings.MaxEdits using 1 FormFuzzySearc parameter.Criteria and 0 hQuerry result.CategorySearchFields and apply boosts. 0 Adds this query to result.AllQueries. 1 Creates a BooleanQuery (OR) of all queries in 2 CombineQuerie result.AllQueries and assigns it to 0 s result.CombinedQuery. 0 1 Creates a SearchDescriptor with a 3 ApplyQueryAndF FunctionScore query using 0 ilter result.CombinedQuery and 0 result.CombinedFilter, with a FieldValueFactor function using the boost field and assign it to result.SearchDescriptor. 1 Sets result.SearchDescriptor's From and Size 4 ApplyPaging variables using result.StartRow and 0 result.PageSize. 0 1 Sets result.SearchDescriptor's sort to sort on the 5 ApplySortOrder sortOrder field in descending order then on 0 _score in descending order. 0 1 Uses result.ElasticsearchIndex.Client to call 6 PerformSearch Elasticsearch using result.SearchDescriptor and 0 assigns the result to result.SearchResponse. 0 If result.SearchResponse is not null and is valid, 1 creates a new CategorySearchResult with the 7 ProcessSearchR search result count and an IEnumerable of 0 esponse CategorySearchResultDto objects using 0 result.SearchResponse.Documents then assigns this to result.CategorySearchResult. ContentIndexerPipeline CreateElasticsearchContent O r d Pipe Description e r Creates a new ElasticsearchContent using the parameter object's fields and assigns it to 1 CreateElasticsea result.ElasticsearchContent. 0 rchContent 0 Fields that vary based on language, persona are populated by filtering parameter.IndexableContentItem.Fields for the field with the appropriate context. GetIndexableContentItems O r d Pipe Description e r Creates an Entity Framework 1 GetIndexableConte IndexableContentItem query using the 0 ntItemQuery parameter object's fields and assigns it to 0 result.IndexableContentItems. ContentSearchPipeline RunContentSearch O r d Pipe Description e r Sets result.PageSize based on 1 ValidatePageSi parameter.PageSize, if it is less than or equal to 0 ze zero set to 10, if it is greater than 1000 set to 1000 0 or else set to parameter.PageSize. Creates a BooleanQuery (OR) of two 2 MultiMatchQuery queries for the content fields 0 FormQuery (title, body, metaDescription, and metaKeywords) 0 one of type CrossFields and one of type PhrasePrefix and assigns it to result.Query. Creates a BooleanQuery (AND) of TermQueries to 3 filter on website, language, deviceType, persona 0 FormFilter and not restricted pages and assigns it to 0 result.Filter. Creates a new SearchRequest using result.Query, 4 result.Filter and result.PageSize, then performs 0 PerformSearch the search and assigns the response to 0 result.SearchResponse. Creates an IEnumerable of 5 ContentSearchResultsDto from the ProcessSearch 0 result.SearchResponse.Document fields (title, Response 0 pageType, and URL) and assigns it to result.ContentSearchResults. ProductIndexerPipeline CreateElasticsearchProduct O r d Pipe Description e r 1 Create a new ElasticsearchProduct object using CreateElasticsea 0 the parameter object's fields and assigns it to rchProduct 0 result.ElasticsearchProduct. Joins ElasticseachProduct fields (ShortDescription, Content, ManufacturuerItem, 2 SetSpellingCorre Name, Specifications, ErpNumber, 0 ction CategoryNames, and FilterNames) into a string 0 and assigns it to result.ElasticsearchProduct.SpellingCorrection. GetIndexableProducts O r d Pipe Description e r 1 Creates a string with the GetIndexableProductsSqlState 0 Optimizely default SQL query to mentParts 0 get the correct products and fields from the database and assigns it to result.SqlStatement.Assigns result.IncremenalFilter with the proper SQL snippet if parameter.IsIncremental is true. Combines result.SqlStatement, 2 result.CustomFields, and CombineIndexableProductsSqlS 0 result.IncrementalFilter and tatementParts 0 assigns it to result.FormattedSqlStatement. Gets an IEnumerable using the 3 SQL query from PerformIndexableProductsSqlQ 0 result.FormattedSqlStatement uery 0 and assigns it to result.IndexableProducts. MapElasticSearchProductProperty O r d Pipe Description e r If the parameter.SearchBoost.IsQueryab 1 le is true and MapElasticSearchProductCus 0 parameter.PropertyDefinition.IsCu tomProperties 0 stomProperty is true sets result.Property to a new Nest TextProperty. ProductSearchPipeline FormProductFilter O r Pipe Description d e r 1 Retrieves SearchGeneralSettings and 0 GetSettings ProductRestrictionsSettings and assigns them to 0 the result object. Adds a new MatchQuery using the 2 FormWebsiteFilt result.SiteContext.WebsiteDto.Id on the 0 er websiteId field to result.AllFilters and assigns it 0 to result.WebsiteFilter. Adds a new MatchQuery using the 3 FormLanguageFi result.SiteContext.LanguageDto.LanguageCode 0 lter on the languageCode field to result.AllFilters and 0 assigns it to result.LanguageFilter. Creates a new PrefixQuery to search a single category or the whole category tree based on 4 FormCategoryFil parameter.ProductSearchParameter fields 0 ter (SearchCriteria and IncludeSubcategories) then 0 adds it to result.AllFilters and assigns it to result.CategoryFilter. If Restriction Groups are enabled, uses the 5 ProductSearchPipeline's FormRestriction 0 FormRestrictionGroupFilter pipe to generate a GroupFilter 0 new filter then adds the filter to result.AllFilters and assigns it to result.RestrictionGroupFilter. Creates PrefixQueries for attributes based on 6 parameter.ProductSearchParameter.AttributeVa FormAttributeVa 0 lueIds and combines them into a BooleanQuery. lueFilter 0 That BooleanQuery is added to result.AllFilters and assigned to result.AttributeValueFilter. Creates MatchQuery objects for each product in 7 FormAllowedPro parameter.ProductSearchParameter.AllowedPro 0 ductsFilter ductIds and combines them into a 0 BooleanQuery. That BooleanQuery is add to result.AllFilters and assigned to result.AllowedProductsFilter. If parameter.ProductSearchParameter.PriceFilters has any values a new MatchQuery is created for each filter and combined into a BooleanQuery (OR) then assigned to result.PriceRangeFilter and added to result.AllFilters. If parameter.ProductSearchParameter.PriceFilters has no values and 8 parameter.ProductSearchParameter.MinimumP FormPriceRange 0 rice or Filter 0 parameter.ProductSearchParameter.MaximumP rice have been supplied a new Range query is created using the supplied min/max values with defaults of 0 and 1000000 if either was omitted. That Range query is then added to result.AllFilters and assigned to result.PriceRangeFilter. If no filters were supplied and neither the minimumPrice or maximumPrice were supplied nothing is done and the pipe returns. 9 Creates a BoolQuery (AND) of all filters in 0 CombineFilters result.AllFilters and assigns it to 0 result.CombinedFilter. FormRestrictionGroupFilter O r d Pipe Description e r Attempts to retrieve the restriction group filter from cache based on the current BillTo/ShipTo and assigns it to result.RestrictionGroupFilter. 1 GetRestrictionGroupFilt 0 erFromCache If there was a cached filter the pipeline 0 exits. if there was no cached filter the pipeline continues to the next pipe. Creates a new MatchQuery on the restrictionGroups field to match products with no restriction groups and 2 adds it to result.DefaultVisibilityFilters. GetDefaultVisibilityFilter 0 s 0 Creates a Terms query on the defaultVisibility field with values of empty and show then adds it to result.DefaultVisibilityFilters. Creates an EF query to get the active 3 GetWebsiteRestrictionG restriction groups based on the current 0 roupQuery website and assigns it to 0 result.WebsiteRestrictionGroupQuery. Uses result.WebsiteRestrictionGroupQuery to get active restriction groups then assigns them to result.WebsiteRestrictionGroups. 4 GetWebsiteRestrictionG 0 roups If there are any active restriction groups 0 a BoolQuery (AND) is created from result.DefaultVisibilityFilters and assigned to result.RestrictionGroupFilter then the pipeline exits. If there are no active restriction groups the pipeline continues to the next pipe. If there is no BillTo the pipeline does nothing and continues to the next pipe. 5 GetCustomerRestriction If BillTo or ShipTo are populated 0 GroupIds result.CustomerRestrictionGroupIds is 0 set to the applicable restriction group IDs from result.WebsiteRestrictionGroupQuery. Adds all restriction group IDs from result.WebsiteRestrictionGroups where 6 GetShowOnlyRestriction the restrictiongroup type is "ShowOnly" 0 GroupIds and is an applicable restriction group 0 (result.CustomerRestrictionGroupIds) to result.ShowOnlyRestrictionGroupIds. Adds all restriction group IDs from result.WebsiteRestrictionGroups where 7 GetShowRestrictionGrou the restrictiongroup type is "Show" and 0 pIds is an applicable restriction group 0 (result.CustomerRestrictionGroupIds) to result.ShowRestrictionGroupIds. Adds all restriction group IDs from result.WebsiteRestrictionGroups where 8 GetHideRestrictionGrou the restrictiongroup type is "Hide" and is 0 pIds an applicable restriction group 0 (result.CustomerRestrictionGroupIds) to result.HideRestrictionGroupIds. Creates a Terms query on the field 9 restrictionGroups with the values from 0 FormShowOnlySubFilter result.ShowOnlyRestrictionGroupIds 0 then adds it to result.SubFilters and assigns it to result.ShowOnlySubFilter. If there are no filters in result.DefaultVisibilityFilters and no filters in result.ShowRestrictionGroupIds continue to next pipe. Creates BoolQuery (AND) from the filters 1 in result.DefaultVisibilityFilters.Creates 0 MatchQuery objects on the field FormShowSubFilter 0 restrictionGroups for all restriction 0 groups in result.ShowRestrictionGroupIds. Combines the previously created queries into a BoolQuery (OR) then adds it to result.SubFilters and assigns it to result.ShowSubFilter. If there are no filters in result.HideRestrictionGroupIds continue to next pipe. Creates MatchQuery (NOT) object on the 1 field restrictionGroups for all restrcition 1 FormHideSubFilter groups in 0 result.HideRestrictionGroupIds. 0 Combines the previously created queries into a BoolQuery (AND) then adds it to result.SubFilters and assigns it to result.HideSubFilter. If result.ShowOnlySubFilter is empty and result.SubFilters is empty continue to 1 next pipe. 2 CombineFilters 0 Create a BoolQuery (AND) fromt he 0 filters in result.SubFilters. Combine BoolQuery just created and result.ShowOnlySubFilter into a new BoolQuery (OR) and assign it to result.RestrictionGroupFilter. 1 Adds result.RestrictionGroupFilter to the 3 AddRestrictionGroupFilt cache based on the current 0 erToCache BillTo/ShipTo. 0 RunProductSearch O r d Pipe Description e r Retrieves SearchGeneralSettings, CatalogGeneralSettings, FuzzySearchSettings, SponsoredSearchSettings and 1 SearchSuggestionsSettings then assign 0 GetSettings them to the result object. 0 Set result.UsingListPrice, result.CanSortPrice, and result.PriceFacetingEnabled from various settings objects. Retrieve and assign values for result.BoostHelper, 2 InitializeSearchProper result.ElasticsearchIndex, 0 ties result.ElasticsearchQueryBuilder, 0 result.PhraseSuggestConfiguration, and result.ProductSearchFacetProcessor. 3 Populate result.SortOrderFields based on 0 FormSortOrder parameter.ProductSearchParameter fields. 0 4 Create a new Nest SortDescriptor and set 0 ApplySortOrder the sort based on result.SortOrderFields. 0 Adds the fields that are queryable using data from the search.SearchBoosts table to result.ExactMatchFields, 5 result.PrefixMatchFields, and 0 GetQueryFields result.PhraseMatchFields. 0 Adds the fields that are part of fuzzy match (categoryNames and shortDescription) to result.FuzzyMatchFields. If parameter.ProductSearchParameter.Searc hCriteria is blank continue on to next pipe without doing anything else. Creates and assigns queries for 6 FormSearchCriteriaQ result.ExactMatchQuery, 0 uery result.PrefixMatchQuery, 0 result.PhraseMatchQuery and result.FuzzyMatchQuery (if enabled) based on the fields assigned in GetQueryFields pipe. All new queries added to result.AllQueries. If parameter.ProductSearchParameter.Searc hCriteria is blank for BillTo and ShipTo are 7 null continue on to next pipe without doing FormCustomerName 0 anything else. Query 0 If BillTo is not null create a PrefixQuery on the customerNames field and match on BillTo.Id + searchCriteria. If ShipTo is not null create a PrefixQuery on the customerNames field and match on ShipTo.Id + searchCriteria. Create a BoolQuery (OR) from the previously created queries then add it to result.AllQueries and assign it to result.CustomerNameQuery. If parameter.ProductSearchParameter.Searc hWithin is blank continue on to the next pipe without doing anything else. 8 FormSearchWithinQu 0 Create a MultiMatchQuery of type ery 0 CrossFields for Product on the result.ExactMatch fields querying on parameter.ProductSearchParameter.Searc hWithin and assign it to result.SearchWithinQuery. Create a BoolQuery (OR) from result.AllQueries. If result.SearchWithinQuery is not null 9 create a BoolQuery (AND) with it and the 0 CombineQueries previously created BoolQuery. 0 Assign the resulting BoolQuery to result.CombinedQuery (either just the first BoolQuery or the combined BoolQuery). 1 Use the ProductSearchPipeline's 0 FormProductFilter pipeline to get the FormProductFilter 0 product filter and assign it to 0 result.FormProductFilterResult. If parameter.ProductSearchParameter.DoFa cetedSearches is false continue on to the next pipe without doing anything else. If parameter.ProductSearchParameter.Searc hCriteria is blank and 1 parameter.ProductSearchParameter.Includ 1 FormCategoryAggrega eSubcategories is false continue on to the 0 tion next pipe without doing anything else. 0 Using result.FormProductFilterResult.AllFilters create a BoolQuery (AND). With that query create FilterAggregationDescriptor func for the categories field and add it to result.AllAggregations and assign it to result.CategoryAggregation. If parameter.ProductSearchParameter.DoFa cetedSearches is false or result.SearchGeneralSettings.EnableAttrib uteFilters is false continue on to the next pipe without doing anything else. If 1 result.SearchGeneralSettings.FilterOnSear 2 FormAttributeValueAg ch if false and 0 gregation parameter.ProductSearchParameter.Searc 0 hCriteria is not blank continue on to the next pipe without doing anything else. Using result.FormProductFilterResult.AllFilters create a BoolQuery (AND). With that query create FilterAggregationDescriptor func for the filters field and add it to result.AllAggregations and assign it to result.AttributeValueAggregation. If parameter.ProductSearchParameter.GetAll AttributeFacets is false continue on to the next pipe without doing anything else. Using result.FormProductFilterResult.AllFilters where the filters are not equal to result.FormProductFilterResult.AttribueVal ueFilter create a BoolQuery (AND). With that query create FilterAggregationDescriptor func for the filters field and add it to result.AllAggregations and assign it to result.AllAttributeValueAggregation. If parameter.ProductSearchParameter.DoFa cetedSearches is false or result.PriceFacetingEnabled is false continue on to the next pipe without doing anything else. 1 3 FormPriceRangeAggre Using 0 gation result.FormProductFilterResult.AllFilters 0 where the filters are not equal to result.FormProductFilterResult.PriceRange Filter create a BoolQuery (AND). With that query create FilterAggregationDescriptor func for the priceFacet field and add it to result.AllAggregations and assign it to result.PriceRangeAggregation. 1 FormPersonaScoreFu If parameter.SiteContext.PersonaDtos 3 nctionList contains personas with EnableSearchBoost 5 true, the result ScoreFunctions collection 0 will be populated with one WeightFunction for each persona with a TermQuery on the Persona.Id and boost value as a Weight. The ScoreFunctions collection will be added to the query by the ApplyQueryAndFilter pipe. If parameter.ProductSearchParameter.DoFa cetedSearches is false continue on to the 1 next pipe without doing anything else. 4 CombineAggregations 0 Call result.CombinedAggregation.Filter for 0 each aggregation in result.AllAggregations and assign the result to result.CombinedAggregation. If result.PhraseSuggestConfiguration.Enable d is false or productSearchParameter.IncludeSuggestio ns is false or productSearchParameter.SearchCriteria is blank continue on to the next pipe without 1 doing anything else. 5 FormDidYouMeanSug 0 gestion Call 0 result.PhraseSuggestConfiguration.Configu re with productSearchParameter.SearchCriteria and result.SearchSuggestions.DidYouMeanThre shold (limited to 0 to 5) and assign the value to result.DidYouMeanSuggestion and add it to result.AllSuggestions. If result.PhraseSuggestConfiguration.Enable d is false or productSearchParameter.IncludeSuggestio ns is false or productSearchParameter.SearchCriteria is blank continue on to the next pipe without 1 doing anything else. 6 FormAutoCorrectSugg 0 estion Call 0 result.PhraseSuggestConfiguration.Configu re with productSearchParameter.SearchCriteria and result.SearchSuggestions.AutoCorrectThre shold (limited to 0 to 5) and assign the value to result.DidYouMeanSuggestion and add it to result.AllSuggestions. If result.PhraseSuggestConfiguration.Enable d is false or productSearchParameter.IncludeSuggestio ns is false or 1 productSearchParameter.SearchCriteria is 7 CombineSuggestions blank continue on to the next pipe without 0 doing anything else. 0 Call result.CombinedSuggestion.Phrase for each suggestion in result.AllSuggestions and assign the result to result.CombinedSuggestion. If 1 result.PhraseSuggestConfiguration.Enable 8 ApplySuggestion d is false or 0 productSearchParameter.IncludeSuggestio 0 ns is false or productSearchParameter.SearchCriteria is blank continue on to the next pipe without doing anything else. Call result.SearchDescriptor.Suggest with result.CombinedSuggestion and assign the result to result.SearchDescriptor. If parameter.ProductSearchParameter.DoFa cetedSearches is false or result.AllAggregations is empty continue on to the next pipe without doing anything 1 else. 9 PerformAggregationSe 0 arch Create an AggregationSearchDescriptor 0 from result.CombinedQuery and result.FormProductFilterResult.CombinedF ilter then use that to query Elasticsearch. Assign result from Elasticsearch to result.AggregationSearchResponse. Use 2 result.ProductSearchFacetProcessor.Proc 0 ProcessCategoryAggr essCategoryFacets to process the facets 0 egation and assign the return value to 0 result.ProductSearchResult.CategoryDtos. Use 2 ProductSearchFacetProcessor.ProcessAttr 1 ProcessAttributeValue ibuteTypeFacets to process the facets and 0 Aggregation assign the return value to 0 result.ProductSearchResult.AttributeTypeD tos. 2 Use 2 ProcessPriceRangeAg ProductSearchFacetProcessor.ProcessPric 0 gregation eRangeFacets to process the facets and 0 assign the return value to result.ProductSearchResult.PriceRangeDto. If result.SponsoredSearchSettings.Enabled is false or parameter.IsAutocomplete is true or this is a filtered search or if this is not sorted by relevance or parameter.ProductSearchParameter.Searc hCriteria is blank continue on to the next pipe without doing anything else. 2 Create a new TermQuery on the 3 PerformSponsoredSe isSponsored field. That is added to a new 0 arch query along with result.CombinedQuery 0 and result.FormProductFilterResult.CombinedF ilter with a max result length of result.SponsoredSearchSettings.Limit or 5. This is used to query Elasticsearch. The results are assigned to result.SponsoredSearchResponse. If result.SponsoredSearchResponse is null continue on to the next pipe without doing anything else. Create a new QueryContainerDescriptor to exclude all sponsored result Ids and assign it to result.ExcludeSponsoredProductsFilter. 2 4 ProcessSponsoredSe Set result.ProductSearchResult.Count to 0 archResponse the sponsored search's total results. 0 If this is the first page of results (result.StartRow equals 0), add the returned products to result.ProductSearchResult.Products and set result.PageSize to result.PageSize minus the number of sponsored results returned. If this is not the first page of results (result.StartRow does not equal 0), set result.StartRow to result.StartRow minus the number of sponsored results returned. If result.ExcludeSponsoredProductsFilter is not null make a new new boolean query with result.FormProductFilterResult.CombinedF ilter and result.ExcludeSponsoredProductsFilter. If result.CombinedQuery is null create a SearchDescriptor using only the above created filter or result.FormProductFilterResult.CombinedF ilter. If result.CombinedQuery is not null and 2 result.SearchGeneralSettings.EnableProdu 5 ApplyQueryAndFilter ctBoost is true, create a SearchDescriptor 0 with a FunctionScore query using 0 result.CombinedQuery and the above created filter or result.FormProductFilterResult.CombinedF ilter with a FieldValueFactor function using the boost field and assign it to result.SearchDescriptor. If result.ScoreFunctions collection is not null or empty, these functions will be added to the FunctionScore query. This will provide boosting of products with certain personas. If result.CombinedQuery is not null and result.SearchGeneralSettings.EnableProdu ctBoost is false, createa SearchDescriptor using result.CombinedQuery and the above created filter or result.FormProductFilterResult.CombinedF ilter. 2 Set from and size on 6 ApplyPaging result.SearchDescriptor using 0 result.StartRow and result.PageSize. 0 2 Set from and size on 7 PerformSearch result.SearchDescriptor using 0 result.StartRow and result.PageSize. 0 If result.SearchResponse is null or is not valid return a SearchFailure code with relevant message. Add returned products from SearchResponse to result.ProductSearchResult.Products. Add the total count of returned products to 2 result.ProductSearchResult.Count. 8 ProcessSearchRespo 0 nse If result.CanSortByPrice is false or 0 result.UsingListPrice is false and result.ProductSearchResult.Count is greater than result.CatalogGeneralSettings.PriceSortMa ximum, then set result.CanSortByPrice to false, set result.ProductSearchResult.SortOrder to result.SortBy and set result.ProductSearchResult.SortOptions to parameter.SortOptions where PriceLowToHigh and PriceHighToLow are removed. If result.CanSortByPrice is true or result.UsingListPrice is true and result.ProductSearchResult.Count is less than or equal to result.CatalogGeneralSettings.PriceSortMa ximum, then set result.ProductSearchResult.SortOptions to parameter.SortOptions. If result.SearchResponse.Suggest is null or result.SearchResponse.Suggest does not contain the key "didyoumean" or didYouMeanSuggestions.Length is not 2 equal to 1 continue on to the next pipe 9 ProcessDidYouMeanS without doing anything else. 0 uggestion Populate 0 result.ProductSearchResult.DidYouMeanS uggestions from the result.SearchResponse.Suggest entry for "didyoumean". If result.SearchResponse.Suggest is null or result.SearchResponse.Suggest does not contain the key "correction" or autoCorrectSuggestions.Length is not 3 equal to 1 continue on to the next pipe 0 ProcessAutoCorrectS without doing anything else. 0 uggestion Populate 0 result.ProductSearchResult.AutoCorrectSu ggestion from the result.SearchResponse.Suggest entry for "correction". Third-party search pipeline Suggest Edits Note This pipeline information is applicable to Elasticsearch version 7.10 (Nest7) and any third-party search provider extending third-party search abstractions and Shared Search pipelines. For an overview of third-party search functionality, see Implement a third-party search provider. For pipeline information specific to default Elasticsearch version 5.5 (Nest5) implementations in Configured Commerce, see Search pipelines. CategorySearchPipeline - Shared RunCategorySearch - Shared O r d Pipe Description e r 1 Maps parameters for SearchClient, InitializeSearchP 0 SearchQueryBuilder, and roperties 0 SearchCategoryMapper into result. Uses Dependency Injection to get instances of 2 SearchGeneralSettings and 0 GetSettings FuzzySearchSettings, attaching to the result to 0 be used during pipeline processing. Uses Dependency Injection to get an instance of 3 the IBoostHelper get searchBoosts for Category, 0 GetQueryFields attaching to the result to be used during pipeline 0 processing. 4 Takes the parameter's StartRow and PageSize 0 FormPaging attaching to the result to be used during pipeline 0 processing. Attaches the DisallowedCategories List generated from the ProductSearchProvider. 5 FormCategoryEx The DisallowedCategories List will be cached for 0 cludeList 15 minutes. Cache Key is based on 0 ("CategorySearchDisallowedCategories" + + ) 6 Using result.DisallowedCategories List to filter FormCategoryEx 0 out categories generated during cludeFilter 0 FormCategoryExcludeList pipe processing. Using result.SiteContext.LanguageDto to filter 7 FormLanguageFi Search Results to a specific LanguageCode. 0 lter If not processed, will include results from all 0 Languages. Uses result.SiteContext.WebsiteDto to filter 8 FormWebsiteFilt Search Results to a specific Website. 0 er If result.SiteContext.WebsiteDto is null, will 0 cause Pipeline Exception/Error. 9 Uses Parameter.AddTypeFilter will add a Query 0 FormTypeFilter Filter for 'type' equaling 'category'. 0 Combines result.AllFilters into a single 1 SearchQuery with an Operation of 'And' setting 0 CombineFilters Query to result.CombinedFilter. 0 If no filters are found, will set 0 result.CombinedFilter to null. Creates a SearchQuery from 1 result.CategorySearchFields against the 1 FormMainSearc parameter.Criteria query value for a 0 hQuery MultiMatchQuery and MultiMatchPrefixQuery 0 search type. 1 Creates a SearchQuery from 2 FormFuzzySearc result.CategorySearchFields against the 0 hQuery parameter.Criteria query value for a 0 MultiMatchFuzzyQuery search type. 1 Combines result.AllQueries into a single 3 CombineQuerie SearchQuery with an Operation of 'Or' setting 0 s Query to result.CombinedQuery. 0 1 Creates a FunctionScoreQuery attaching as a 4 ApplyQueryAndF new SearchDescriptor. 0 ilter The Score Function is for the Boost Field with a 0 FunctionBoostMode.Multiply boost function. Creates a single BooleanQuery from result.CombinedQuery and result.CombinedFilter using the Operation of 'And' for the FunctionScoreQuery. 1 5 ApplyPaging Sets From and Size on result.SearchDescriptor. 0 0 Creates SortDescriptor using the 1 ISearchCategoryObject.SortOrder and 6 ApplySortOrder SortOrderField.Score as fields that will be set as 0 SortOrder.Descending. 0 Sets on Sort of result.SearchDescriptor. 1 Performs result.SearchResult.Search(...) passing 7 in parameter.IndexType and PerformSearch 0 result.SearchDescriptor as arguments, saving 0 result to result.SearchResponse. 1 Validates for null and IsValid details of 8 ProcessSearchR result.searchResponse. 0 esponse Returns an Error PipelineResult when the results 0 are not valid. ContentSearchPipeline - Shared RunContentSearch - Shared O r d Pipe Description e r Uses Dependency Injection to get 1 instance of SearchGeneralSettings 0 InitializeSearchProperties attaching to 0 result.SearchGeneralSettings to be used during pipeline processing. Validates parameter.PageSize is 2 between 0 and 1000, setting 0 ValidatePageSize result.PageSize. If less than 10 will set 0 value to 10,;if greater than 1000 sets value to 1000. Makes a MultiMatchQuery with ISearchContentObject.Title, ISearchContentObject.Body, ISearchContentObject.MetaDescriptio n and ISearchContentObject.MetaKeywords fields to boost against the parameter.Query with the arguments SearchAnalyzerTypes.QueryAnalyzer, SearchOperator.Or and SearchTextQueryType.CrossFields. Makes a MultiMatchQuery with ISearchContentObject.Title, ISearchContentObject.Body, 3 ISearchContentObject.MetaDescriptio 0 FormQuery n and 0 ISearchContentObject.MetaKeywords fields to boost against the parameter.Query with the arguments SearchAnalyzerTypes.LowercaseAnalyz er, SearchOperator.Or, SearchTextQueryType.PhrasePrefix, a 'slop' of 100, a 'boostName' of SearchBoost.QueryType.Prefix. Makes a BooleanQuery of prior MultiMatchQuery with the Operation.Or assigns to variable 'combined'. Makes a FieldQuery with ISearchContentObject.ContentKey based on if perRequestCacheManager has a value for "SpireContent" assigns to variable 'cmsTypeFilter'. Makes a BooleanQuery from variables 'combined' and 'cmsTypeFilter' using the Operation.And assigns to result.Query. Makes multiple TermQuery one for each listed field: ISearchContentObject.WebsiteId, ISearchContentObject.LanguageId, ISearchContentObject.DeviceType and ISearchContentObject.PersonaId using 4 values from the SiteContext.Current. 0 FormFilter Makes a TermQuery for the field 0 ISearchContentObject.ContentKey with the values from IContentPageFilterService.GetRestricte dPages. Makes a single BooleanQuery from the above TermQuery objects using the Operation.And assigns to result.Filter. If parameter.ProductSearchParameter.D oFacetedSearches is false or result.AllAggregations is empty, continues to the next pipe. Creates a new SearchDescriptor ISearchContentObject assigns to 5 variable 'searchDescriptor'. Makes a 0 PerformSearch BooleanQuery from result.Query and 0 result.Filter with an Operation.And setting searchDescriptor.WithQuery. Sets result.PageSize using searchDescriptor.WithSize. Creates AggregationContainer with Term of 'contentAggregation' (PerformSearch.ContentAggregationKe y), that includes a Term of ISearchContentObject.Url and Size of result.PageSize. Pior AggreationContainer includes a nested AggreationContainer with Term of 'contentAggregation_top_hits' (PerformSearch.TopHitsAggregationKey ), that includes a TopHits name of 'contentAggregation_top_hits' (PerformSearch.TopHitsAggregationKey ) and Size of 1. (This is done to create a known structure for how the URLs aggregation should be retrived in, this works well with Elasticsearch but might need finessing to work with other providers.) result.CombinedQuery is null create an SearchDescriptor ISearchProductObject.WithPostFilter from result.FormProductFilterResult.Combi nedFilter. Assigns result from parameter.SearchClient.Search to result.SearchResponse. If result.SearchResponse.Aggregations does not contain PerformSearch.ContentAggregationKey , continues to the next pipe. Selects from the the 6 PerformSearch.ContentAggregationKey 0 ProcessSearchResponse Items any 0 PerformSearch.TopHitsAggregationKey using the parameter.SearchContentMapper.ToC ontentSearchResultDto to create new ContentSearchResultDto assigns the resulting collection to result.ContentSearchResults. If result.SearchResponse.Aggregations does not contain PerformSearch.ContentAggregationKey , continues to the next pipe. Selects from result.SearchResponse.Aggregations 7 ProcessSearchResponseF all 0 orAllAggregations PerformSearch.TopHitsAggregationKey 0 using the parameter.SearchContentMapper.ToC ontentSearchResultDto to create new ContentSearchResultDto assigns the resulting collection to result.ContentSearchResults. If result.ContentSearchResults is empty continue to the next pipe. Selects from result.SearchResponse.Hits all not null 8 ProcessSearchResponseF and using the 0 romResult parameter.SearchContentMapper.ToC 0 ontentSearchResultDto to create new ContentSearchResultDto assigns the resulting collection to result.ContentSearchResults. IndexBuilderPipeline - Shared ConfigureIndexSettings - Shared O r d Pipe Description e r Looping through the parameter.FieldTypeList will create and 1 add the properties as ModelField instances 0 GetIndexFields to 0 result.CreateIndexDescriptor.FieldModelLi st. Using the IEntityDefinitionProvider to get 2 the Category Definition and add all GetIndexCategoryCust 0 IsCustomProperty flagged Properties to omPropertyFields 0 result.CreateIndexDescriptor.FieldModelLi st. Using IBoostHelper.GetSearchBoosts to 3 get Product SearchBoost Records and add GetIndexProductCusto 0 all starting with Field_attributes. to mPropertyFields 0 result.CreateIndexDescriptor.FieldModelLi st. Using the IEntityDefinitionProvider to get 4 the Product Definition and add all GetIndexProductAttrib 0 IsCustomProperty flagged Properties to utePropertyFields 0 result.CreateIndexDescriptor.FieldModelLi st. ProductSearchPipeline - Shared FormProductFilter - Shared O r d Pipe Description e r 1 Uses Dependency Injection to get SearchGeneralSettings GetSettin 0 and ProductRestrictionsSettings; then assigns them to the gs 0 result object. 2 FormWe Sets variable 'websiteId' with 0 bsiteFilte parameter.ProductSearchParameter.WebSiteId or 0 r parameter.SiteContext.WebsiteDto.Id. If variable 'websiteId' is null, continues to next pipe. Create FieldQue using the variable of 'websiteId' on the ISearchProductObject.Websites field and assign it to result.WebsiteFilter. Adds result.WebsiteFilter to result.AllFilters. If parameter.SiteContext.LanguageDto is null, continues to next pipe. 3 FormLan Makes a FieldQuery using the 0 guageFilt parameter.SiteContext.LanguageDto.LanguageCode on 0 er the ISearchProductObject.LanguageCode field and assign it to result.LanguageFilter. Add result.LanguageFilter to result.AllFilters. If parameter.ProductSearchParameter.CategoryId is null continue to next pipe. Makes a PrefixQuery to search against ISearchProductObject.Categories or 4 FormCat ISearchProductObject.Categories based on 0 egoryFilt parameter.ProductSearchParameter.SearchCriteria and 0 er parameter.ProductSearchParameter.IncludeSubcategorie s and assigns it to result.CategoryFilter. Add result.CategoryFilter to result.AllFilters. If parameter.ProductSearchParameter.BrandIds is null or empty continue to next pipe. When parameter.ProductSearchParameter.BrandIds has only 1 brandId, make a FieldQuery for the ISearchProductObject.BrandId field against the single 5 FormBra 'brandId' assigns it to result.BrandFilter. When 0 ndFilter parameter.ProductSearchParameter.BrandIds is greater 0 than 1, make a collection of FieldQuery queries from the parameter.ProductSearchParameter.BrandIds collection assigns a BooleanQuery with the Operation.Or of the FieldQuery collection. Add result.BrandFilter to result.AllFilters. 6 FormPro If parameter.ProductSearchParameter.ProductLineIds is 0 ductLine null or empty continue to next pipe. When 0 Filter parameter.ProductSearchParameter.ProductLineIds has only 1 'productLineId', make a FieldQuery for the ISearchProductObject.ProductLineId field against the single 'productLineId' assigns it to result.ProductLineFilter. When parameter.ProductSearchParameter.ProductLineIds is greater than 1, make a collection of FieldQuery queries from the parameter.ProductSearchParameter.ProductLineIds collection for the ISearchProductObject.ProductLineId field assigns a BooleanQuery with the Operation.Or of the FieldQuery collection. Add result.ProductLineFilter to result.AllFilters. If parameter.FormRestrictionGroupFilter is false or result.ProductRestrictionsSettings.RestrictionsByItem is false, continue to next pipe. Uses the IProductSearchPipeline.FormRestrictionGroupFilter pipe to generate a new filter and if IProductSearchPipeline.FormRestrictionGroupFilter does not return a ResultCode.Success will PipelineHelper.CopyResult and continue to next pipe. If result.SearchGeneralSettings.NestedDocumentsInteractio nEnabled is false then the newly generated filter is assigned to result.RestrictionGroupFilter. If 7 FormRes result.SearchGeneralSettings.NestedDocumentsInteractio 0 trictionGr nEnabled is true, 0 oupFilter IProductSearchPipeline.FormChildProductsRestrictionGro upFilter is used to generated the child products restriction group filter and if IProductSearchPipeline.FormRestrictionGroupFilter does not return a ResultCode.Success will PipelineHelper.CopyResult and continue to next pipe. The child products restriction group filter is assigned to result.ChildProductsRestrictionGroupFilter and the further the child restriction group filter is combined with Nested Query to check if ISearchProductObject.ChildProducts field path exists and form nested query on child restriction group filter. The nested child products restriction groups filter and parent restrictions group filter are combined using BooleanQuery with Operation.And and assigned to result.RestrictionGroupFilter. Add result.RestrictionGroupFilter to result.AllFilters if result.RestrictionGroupFilter is not null. If parameter.ProductSearchParameter.AttributeValueIds is null or empty continue to next pipe. Make a PrefixQuery for each parameter.ProductSearchParameter.AttributeValueIds 8 FormAttri against the ISearchProductObject.Filters field and 0 buteValu combines them into a BooleanQuery with the 0 eFilter Operation.Or. Makes a BooleanQuery with the Operation.And for each 'attributeTypeQueries' assigns to result.AttributeValueFilter. Adds result.AttributeValueFilter to result.AllFilters. If parameter.ProductSearchParameter.AllowedProductIds is null or empty continue to next pipe. Makes FieldQuery for each product in 9 FormAllo parameter.ProductSearchParameter.AllowedProductIds 0 wedProd against the ISearchProductObject.ProductId field and 0 uctsFilter combines them into a BooleanQuery using the Operation.Or assigns to result.AllowedProductsFilter. Adds result.AllowedProductsFilter to result.AllFilters. If parameter.ProductSearchParameter.PriceFilters is null or empty and parameter.ProductSearchParameter.MinimumPrice or parameter.ProductSearchParameter.MaximumPrice is null 1 continue to next pipe. FormPric 0 If parameter.ProductSearchParameter.PriceFilters has any eRangeFi 0 values make a FieldQuery for each filter in lter 0 parameter.ProductSearchParameter.PriceFilters and combined into a BooleanQuery with the Operation.Or assigns to result.PriceRangeFilter. If parameter.ProductSearchParameter.PriceFilters has no values and makes a NumericRangeQuery for the ISearchProductObject.Price field using using parameter.ProductSearchParameter.MinimumPrice and parameter.ProductSearchParameter.MaximumPrice with defaults of 0 and 1000000 if either are omitted assigns to result.PriceRangeFilter. Adds result.PriceRangeFilter to result.AllFilters. If parameter.ProductSearchParameter.ProductIds is null or empty continue to next pipe. Makes FieldQuery for each 1 FormPro product in parameter.ProductSearchParameter.ProductIds 1 ductIdFilt against the ISearchProductObject.ProductId field and 0 er combines them into a BooleanQuery using the 0 Operation.Or assigns to result.ProductIdFilter. Adds result.ProductIdFilter to result.AllFilters. If parameter.ProductSearchParameter.ProductNames is null or empty continue to next pipe. Makes FieldQuery for 1 each product in FormPro 2 parameter.ProductSearchParameter.ProductNames ductNam 0 against the ISearchProductObject.Name field and eFilter 0 combines them into a BooleanQuery using the Operation.Or assigns to result.ProductNameFilter. Adds result.ProductNameFilter to result.AllFilters. If parameter.ProductSearchParameter.ProductErpNumbers is null or empty continue to next pipe. Makes FieldQuery for 1 FormPro each product in 3 ductErpN parameter.ProductSearchParameter.ProductErpNumbers 0 umberFil against the ISearchProductObject.ErpNumberSort field 0 ter and combines them into a BooleanQuery using the Operation.Or assigns to result.ProductErpNumberFilter. Adds result.ProductErpNumberFilter to result.AllFilters. 1 Makes a BoolQuery with the Operation.And of all filters in 4 Combine result.AllFilters and assigns it to result.CombinedFilter or 0 Filters null if filters are empty. 0 FormRestrictionGroupFilter - Shared O r d Pipe Description e r Attempts to retrieve the restriction group filter from the IPerRequestCacheManager cache based on the current parameter.SiteContext.BillTo.Id and parameter.SiteContext.ShipTo.Id and assigns it 1 GetRestrictionGro to result.RestrictionGroupFilter. 0 upFilterFromCach (SearchProvider_RestrictionGroupFilter__) If the result.RestrictionGroupFilter is set the pipeline exits. If there was no result.RestrictionGroupFilter the pipeline continues to the next pipe. Makes a MatchQuery on the ISearchProductObject.RestrictionGroups field to match products with no restriction groups 2 GetDefaultVisibility and adds it to result.DefaultVisibilityFilters. 0 Filters Makes a FieldMultivalueQuery on the 0 ISearchProductObject.DefaultVisibility field with of show then adds it to result.DefaultVisibilityFilters. Creates an EntityFramework query calling 3 GetActiveRestrictionGroupsAsNoTracking with GetWebsiteRestric 0 the parameter.SiteContext.WebsiteDto.Id (the tionGroupQuery 0 current website) and assigns it to result.WebsiteRestrictionGroupQuery. Uses result.WebsiteRestrictionGroupQuery to 4 GetWebsiteRestric get active restriction groups then assigns them 0 tionGroups to result.WebsiteRestrictionGroups. 0 If result.WebsiteRestrictionGroups is not empty continue on to the next pipe. If result.WebsiteRestrictionGroups is empty create a BooleanQuery with an Operation.And is created from result.DefaultVisibilityFilters and assigned to result.RestrictionGroupFilter. Sets result.ExitPipeline to true exiting the Pipeline. If parameter.SiteContext.BillTo is null continues to the next pipe. If parameter.SiteContext.BillTo and parameter.SiteContext.ShipTo are populated set result.CustomerRestrictionGroupIds to the 5 restriction group Ids from GetCustomerRestr 0 result.WebsiteRestrictionGroupQuery. If ictionGroupIds 0 parameter.SiteContext.BillTo is not null and parameter.SiteContext.ShipTo is null set result.CustomerRestrictionGroupIds to the restriction group Ids for just the parameter.SiteContext.BillTo.Id from result.WebsiteRestrictionGroupQuery. If result.CustomerRestrictionGroupIds is empty continue to next pipe. Adds all restriction group Ids from result.WebsiteRestrictionGroups 6 GetShowOnlyRestr where the restrictiongroup type is "ShowOnly" 0 ictionGroupIds (RestrictionGroup.RestrictionGroupDisplayTyp 0 e.ShowOnly) and is an applicable restriction group (result.CustomerRestrictionGroupIds) to result.ShowOnlyRestrictionGroupIds. If result.CustomerRestrictionGroupIds is empty continue to next pipe. Adds all restriction group 7 GetShowRestrictio Ids from result.WebsiteRestrictionGroups 0 nGroupIds where the restrictiongroup type is "Show" 0 (RestrictionGroup.RestrictionGroupDisplayTyp e.Show) and is an applicable restriction group (result.CustomerRestrictionGroupIds) to result.ShowRestrictionGroupIds. If result.CustomerRestrictionGroupIds is empty continue to next pipe. Adds all restriction group Ids from result.WebsiteRestrictionGroups 8 GetHideRestriction where the restrictiongroup type is "Hide" 0 GroupIds (RestrictionGroup.RestrictionGroupDisplayTyp 0 e.Hide) and is an applicable restriction group (result.CustomerRestrictionGroupIds) to result.HideRestrictionGroupIds. If result.CustomerRestrictionGroupIds is empty continue to next pipe. Creates a FieldMultivalueQuery on the 9 FormShowOnlySub ISearchProductObject.RestrictionGroups field 0 Filter with the values from 0 result.ShowOnlyRestrictionGroupIds then adds it to result.SubFilters and assigns it to result.ShowOnlySubFilter. If result.DefaultVisibilityFilters is empty and result.ShowRestrictionGroupIds is empty continue to next pipe. Creates BooleanQuery with Operation.And from the filters in result.DefaultVisibilityFilters. Creates 1 FieldQuery objects on the field 0 FormShowSubFilte ISearchProductObject.RestrictionGroups for all 0 r restriction groups in 0 result.ShowRestrictionGroupIds. Combines the previously created queries into a BooleanQuery with the Operation.Or then assigns it to result.ShowSubFilter. Adds result.ShowSubFilter to result.SubFilters. 1 If result.HideRestrictionGroupIds is empty 1 continue to next pipe. Creates FieldQuery as FormHideSubFilter 0 Not on the field 0 ISearchProductObject.RestrictionGroups for all restrcition groups in result.HideRestrictionGroupIds. Combines the previously created queries into a BooleanQuery with the Operation.And and assigns it to result.HideSubFilter. Add result.HideSubFilter to result.SubFilters. If result.ShowOnlySubFilter is empty and result.SubFilters is empty continue to next pipe. 1 Create a BooleanQuery with the Operator.And 2 from the filters in result.SubFilters. Combine CombineFilters 0 result.ShowOnlySubFilter and the prior 0 result.SubFilters BooleanQuery into a new BooleanQuery with the Operation.Or and assign it to result.RestrictionGroupFilter. If result.RestrictionGroupFilter is null continue 1 to next pipe. Adds result.RestrictionGroupFilter 3 AddRestrictionGro to the cache based on the result from 0 upFilterToCache GetRestrictionGroupFilterFromCache.GetRestr 0 ictionGroupFilterCacheKey. FormChildProductsRestrictionGroupFilter - Shared O r d Pipe Description e r Attempts to retrieve the restriction group filter from the IPerRequestCacheManager cache based on the current parameter.SiteContext.BillTo.Id and 1 GetRestrictionGro parameter.SiteContext.ShipTo.Id and assigns it 0 upFilterFromCach to result.RestrictionGroupFilter. 0 e (SearchProvider_RestrictionGroupFilter_ChildPr oducts__) If the result.RestrictionGroupFilter is set the pipeline exits. If there was no result.RestrictionGroupFilter the pipeline continues to the next pipe. Makes a MatchQuery on the ISearchProductObject.RestrictionGroups field to match child products with no restriction groups and adds it to result.DefaultVisibilityFilters. Makes a 2 FieldMultivalueQuery on the GetDefaultVisibilit 0 ISearchProductObject.DefaultVisibility field yFilters 0 with of show then adds it to result.DefaultVisibilityFilters. If parameter.WebsiteRestrictionGroups does not have any, result.DefaultVisibilityFilter is assisgned to result.RestrictionGroupFilter and exit the pipeline. If result.CustomerRestrictionGroupIds is empty continue to next pipe. Creates a FieldMultivalueQuery on the 3 FormShowOnlySu ISearchProductObject.ChildProducts.Restrictio 0 bFilter nGroups field with the values from 0 result.ShowOnlyRestrictionGroupIds then adds it to result.SubFilters and assigns it to result.ShowOnlySubFilter. If result.DefaultVisibilityFilters is empty and result.ShowRestrictionGroupIds is empty continue to next pipe. Creates BooleanQuery with Operation.And from the filters in 4 result.DefaultVisibilityFilters. Creates FormShowSubFilte 0 FieldQuery objects on the field r 0 ISearchProductObject.ChildProducts.Restrictio nGroups for all restriction groups in result.ShowRestrictionGroupIds. Combines the previously created queries into a BooleanQuery with the Operation.Or then assigns it to result.ShowSubFilter. Adds result.ShowSubFilter to result.SubFilters. If result.HideRestrictionGroupIds is empty continue to next pipe. Creates FieldQuery as Not on the field ISearchProductObject.ChildProducts.Restrictio 5 nGroups for all restrcition groups in 0 FormHideSubFilter result.HideRestrictionGroupIds. Combines the 0 previously created queries into a BooleanQuery with the Operation.And and assigns it to result.HideSubFilter. Add result.HideSubFilter to result.SubFilters. If result.ShowOnlySubFilter is empty and result.SubFilters is empty continue to next pipe. Create a BooleanQuery with the Operator.And 6 from the filters in result.SubFilters. Combine 0 CombineFilters result.ShowOnlySubFilter and the prior 0 result.SubFilters BooleanQuery into a new BooleanQuery with the Operation.Or and assign it to result.RestrictionGroupFilter. If result.RestrictionGroupFilter is null continue 7 to next pipe. Adds result.RestrictionGroupFilter AddRestrictionGro 0 to the cache based on the result from upFilterToCache 0 GetRestrictionGroupFilterFromCache.GetRestri ctionGroupFilterCacheKey. RunBrandSearch - Shared O r d Pipe Description e r Uses Dependency Injection to attach IBoostHelper, and 1 InitializeSe SearchGeneralSettings, then assign them to the result 0 archProper object. Set IndexType, SearchClient, and 0 ties SearchQueryBuilder from the parameter to the result. 2 Use the ProductSearchPipeline's FormProductFilter FormProdu 0 pipeline to get the product filter and assign it to ctFilter 0 result.FormProductFilterResult. Using result.BoostHelper to get a list of IsQueryable fields for Brand Entity. If no queryableFields are not 4 GetQueryFi found set result.ExitPipeline to true and continue 0 elds pipeline. Will set 'queryableFields' to 0 result.ExactMatchFields, result.ExactMatchFields and result.ExactMatchFields. Creates a MultimatchQuery, MultimatchPrefixQuery and MultiMatchFuzzyQuery for the typeof(Brand) Entity, 5 using parameter.Criteria against the 0 FormQuery result.ExactMatchFields, result.PrefixMatchFields or 0 result.FuzzyMatchFields fields matching to the query type. 6 Create a BooleanQuery with an Operation.Or for all CombineQ 0 non-null result.AllQueries attaching to ueries 0 result.CombinedQuery. If parameter.ProductLinesEnabled is true fill 'aggregationField' to nameof(ISearchProductObject.BrandProductLineFacet ). If parameter.ProductLinesEnabled is false fill 'aggregationField' to nameof(ISearchProductObject.BrandFacet). With that query create FilterAggregationDescriptor function for 7 FormBrand the Term of 'brandName' 0 Aggregatio (FormBrandAggregation.BrandAggregationKey) term 0 n against the 'aggregationField', with SearchTermOrder Key of 'brandName_max_score' (FormBrandAggregation.MaxScoreAggregationKey) with an Order of SortOrder.Descending, and with Aggregations with Max of 'brandName_max_score' (FormBrandAggregation.MaxScoreAggregationKey) using a Script of '_score' and TopHits of 'brandName_top_hits' (FormBrandAggregation.TopHitsAggregationKey) using a Descending '_score' Sort and Size of 1. Set result.BrandAggregationContainer with result.BrandAggregationContainer.WithFilter taking 'brandName' (FormBrandAggregation.BrandAggregationKey) and result.BrandAggregation as arguments. If result.AllFilters is not null and greater than 0 add 8 result.AllFilters making a BooleanQuery of CombineFil 0 result.AllFilters with the Operation.And. If ters 0 result.AllFilters is null set result.CombinedFilter a value null. Make a BooleanQuery using the Operator.And with result.CombinedQuery and result.CombinedFilter 9 setting 'combinedQueryAndFilter'. Use ApplyQuery 0 'combinedQueryAndFilter' from before and make use AndFilter 0 result.SearchQueryBuilder.MakeFunctionScoreQuery with a FunctionBoostMode.Multiply function using the 'Boost' field and assign it to result.SearchDescriptor. Make a BooleanQuery using the Operator.And with result.CombinedQuery and result.FormProductFilterResult.CombinedFilter setting 'combinedQueryAndFilter'. Create variable 1 'aggregationSearchDescriptor' setting to 0 PerformSe SearchDescriptor().WithQuery using 0 arch 'combinedQueryAndFilter' and with Aggregations of 0 result.BrandAggregationContainer and a Size of 0. Call result.SearchClient.Search with the result.IndexType and 'aggregationSearchDescriptor' arguments setting result to result.AggregationSearchResponse. If result.AggregationSearchResponse.Aggregations is 1 ProcessBra null or empty set result.ExitPipeline to true and 1 ndAggregat continue pipeline. Lookup 0 ion result.AggregationSearchResponse.Aggregations.Aggre 0 gateToHitsTuples for FormBrandAggregation.BrandAggregationKey setting result to vairable 'brandHitsTuples'. Fallback lookup to result.AggregationSearchResponse.Aggregations.Aggre gateToHitsTuples for ISearchProductObject.BrandFacet when FormBrandAggregation.BrandAggregationKey is not found, setting result to vairable 'brandHitsTuples'. If both ISearchProductObject.BrandFacet when FormBrandAggregation.BrandAggregationKey are not found in result.AggregationSearchResponse.Aggregations continue on with the pipeline. Using 'brandHitsTuples' create new SearchTopHitsAggregate with 'Items' assgined from result.AggregationSearchResponse.Hits equal to hit.Source.BrandFacet assign result to result.TopHitsAggregates. If result.TopHitsAggregates is null set result.BrandSearchResult.Brands to empty List and 1 result.ExitPipeline to true then continue on to next pipe. ProcessTop 2 Sets result.BrandSearchResult.Brands by transforming HitsAggreg 0 result.TopHitsAggregates in a collection of ates 0 BrandSearchResultDto. Sets result.BrandSearchResult.Count to result.TopHitsAggregates.Count(). If result.BrandSearchResult.Brands is null continue on to next pipe. If parameter.MaximumNumber is greater than or equal to result.BrandSearchResult.Brands Count order result.BrandSearchResult.Brands using 1 OrderByDescending by 'Score' taking 3 SortAndLim parameter.MaximumNumber. If 0 itBrands parameter.ProductLinesEnabled is true and has any 0 result.BrandSearchResult.Brands that do not have a blank 'ProductLineName', order result.BrandSearchResult.Brands using OrderByDescending by 'Score'. If the prior checks do pass fall back to Soring by Score for the parameter.MaximumNumber. Setting brand results to result.BrandSearchResult.Brands. If parameter.Criteria is null, result.BrandSearchResult?.Brands is null or result.BrandSearchResult.Brands all ProductLineNames are empty continue on to next pipe. Creates a variable 'queryWords' by spliting parameter.Criteria by ' ' (Space). Null the ProductLineId, 1 ProductLineName and ProductLIneUrlSegement fields 4 ProcessPro on result.BrandSearchResult.Brands for the 0 ductLines brandResult's that do not match any queryWords to 0 'ProdctLineName'. Also null the fields if parameter.ProductLinesEnabled is not true. Using result.BrandSearchResult.Brands group by 'Id' and 'ProductLineId', select the first Group and taking parameter.MaximumNumber then assign to result.BrandSearchResult.Brands. This removes duplicates. RunProductFacetSearch - Shared O r Pi d Description pe e r Ini tia liz eS Uses Dependency Injection to attach 1 ea ProductSearchFacetProcessor, and SearchGeneralSettings, then 0 rc assign them to the result object. Set IndexType, SearchClient, and 0 hP SearchQueryBuilder from the parameter to the result. ro pe rti es Fo rm 2 Pr Use the ProductSearchPipeline's FormProductFilter pipeline to get 0 od the product filter and assign it to result.FormProductFilterResult. 0 uc tFil ter Fo If parameter.ProductFacetSearchParameter.BrandStartsWith is 3 rm blank continue on to next pipe. Make a MultimatchPrefixQuery for 0 Qu parameter.ProductFacetSearchParameter.BrandStartsWith against 0 ery the ISearchProductObject.BrandNameFirstCharacter field. Sets result.AllFilters list based on what is set in the parameter object. Filters are added for any non-null parameter.ProductFacetSearchParameter.BrandId, parameter.ProductFacetSearchParameter.ProductLineId, Fo parameter.ProductFacetSearchParameter.GetFeaturedProductLin rm e, parameter.ProductFacetSearchParameter.Manufacturer, or 4 Br parameter.ProductFacetSearchParameter.GetSmallBrandImage. 0 an Based on 0 dFi parameter.ProductFacetSearchParameter.GetFeaturedProductLin lte e or rs parameter.ProductFacetSearchParameter.GetSponsoredProductLi ne flags filters are individually set for the fields ISearchProductObject.ProductLineIsFeatured and ISearchProductObject.ProductLineIsSponsored. Co If result.AllFilters is not null and greater than 0 add m 5 result.FormProductFilterResult.CombinedFilter to result.AllFilters bi 0 making a BooleanQuery of result.AllFilters with the Operation.And. ne 0 If result.AllFilters is null set result.CombinedFilter to the value of Filt result.FormProductFilterResult.CombinedFilter. ers Ge Based on the ProductFacetSearchType value of 6 tF parameter.ProductFacetSearchParameter.SearchType set 0 ac result.FacetField to either: ISearchProductObject.BrandFacet, 0 et ISearchProductObject.BrandNameFirstCharacter, Fie ISearchProductObject.ProductLineFacet, or ld ISearchProductObject.Categories. Will throw an ErrorPipelineResult if not a valid type. Set result.AggregationKey to result.FacetField.ToCamelCase, creating FilterAggregationDescriptor with filter result.CombinedFilter and aggregation using Term result.AggregationKey against field result.FacetField.ToCamelCase. Aggregations are ordered by the SearchTermsOrder key of '_term' ordered by Fo parameter.ProductFacetSearchParameter.SortAscending. Set rm 7 result.AggregationContainer to Ag 0 result.AggregationContainer.WithFilter using result.AggregationKey gre 0 and result.Aggregation as arguments. When result.Query is not null gat sets result.AggregationSearchDescriptor to a SearchDescriptor with ion a Query with the Operation.And of result.Query and result.CombinedFilter. When result.Query is null sets result.AggregationSearchDescriptor to a SearchDescriptor with a Query of result.CombinedFilter. Set result.AggregationContainer with result.AggregationSearchDescriptor.WithAggregations and WithSize of 0. Pe rfo 8 Use result.SearchClient.Search to call a ISearchClient using rm 0 result.IndexType and result.AggregationSearchDescriptor and Se 0 assign the result to result.SearchResponse. ar ch Pr oc Lookup es result.SearchResponse.Aggregations.AggregateToHitsTuples for 9 sA result.AggregationKey setting the response to 0 ggr result.AggregationHits. If 0 eg result.SearchResponse.Aggregations.AggregateToHitsTuples return ati null set to empty List. on Pr oc es If parameter.ProductFacetSearchParameter.SearchType is not 1 sC ProductFacetSearchType.Category continue on to the next pipe. 0 at Use result.ProductSearchFacetProcessor.ProcessCategoryFacets 0 eg to process the facets from result.AggregationHits and assign the 0 ory return value to result.ProductFacetSearchResult. Hit s Pr oc es sB ra If parameter.ProductFacetSearchParameter.SearchType is not 1 nd ProductFacetSearchType.BrandFirstCharacter continue on to the 1 Fir next pipe. Use 0 st result.ProductSearchFacetProcessor.ProcessStringFacets to 0 Ch process the facets from result.AggregationHits and assign the ar return value to result.ProductFacetSearchResult. ac ter Hit s Pr oc If parameter.ProductFacetSearchParameter.SearchType is not 1 es ProductFacetSearchType.Bra

Use Quizgecko on...
Browser
Browser