




WebSphere Commerce search interactions
WebSphere Commerce search includes several key interaction areas, including the
Presentation layer, WebSphere Commerce server, and the search service façade.
The following diagram illustrates the interaction between the various areas of WebSphere Commerce search:
Where:
- The CatalogNavigationView noun is used with the storefront Catalog service to perform searches and search-based navigation in the storefront. This noun represents a business response of a catalog browsing request, containing a list of sub-products, called CatalogEntryView, and a list of subcategories, called CatalogGroupView.
- The main running path involves the Catalog component, where the Catalog navigation service is provided. Depending on the nature of the request, that is, the given search profile, other business components might get involved, such as Marketing for search-based merchandising rules, or contracts for entitlement. Each business component is responsible to contribute a portion of the search expression, which get combined with the main search expression generated by the Catalog navigation service. As a result, the consolidated search expression is run by the Data Service Layer (DSL) against the search engine for processing.
- The response of the search request is in the form of a native search response object, that is, the physical SDO, which is then mediated by the Catalog navigation business object mediator (CatalogNavigationView Read BOM) in the DSL into the Catalog navigation noun (the logical SDO) for use by the caller, such as the search interface.
Search Service Facade
In addition to the existing Data Service Facade, which typically works with database-related requests, the Search Service Facade handles all the search engine-specific requests. The decision between which facade to use is contained in the search profile parameter. If a search profile parameter, for example, _wcf.search.profile, is passed in as part of the control parameter in the XPath expression, the request is run as a search expression that requires a search engine for processing.
The following diagram illustrates the Search Service Facade:












Where:
- Information gathered through the expression builder from the storefront interface includes
keywords, paging and sorting parameters, category ID, and search profile. For
example:
{_wcf.ap='$accessProfile$';_wcf.search.profile='$searchProfile$';_wcf.search.term='$searchTerm$' ;_wcf.search.sort='$orderBy$';_wcf.search.meta='$metaData$'}/CatalogNavigationView
- When the search Get request hits the BOD controller command in the Catalog component, it is mapped down to the Fetch command. The runtime determines which facade to forward the search request by inspecting whether a search profile, _wcf.search.profile, has been provided with the XPath. If it is provided, the request is run as requiring a search engine for processing and therefore routed to the Search Service Facade.
- There are two main search engine-specific components in the Search Service Facade: the search
provider and the search processor.
- SearchExpressionProvider
- Depending on the nature of the request, that is, the given search profile, other business components might get involved, such as Marketing for search-based merchandising rules, or contracts for entitlement. Each business component is responsible to contribute a portion of the search expression, which get combined with the main search expression generated by the Catalog navigation service. As a result, the consolidated search expression is run by the search processor.
- SearchExpressionProcessor
- A search processor is the central processing unit for integrating with the external search engine. Its responsibility is to run the given Solr expression, based on the given search profile attributes, and capture the response from the search engine.
See the query section of WebSphere Commerce search configuration file (wc-search.xml) (WC EAR) for more information.
The default SolrSearchExpressionProvider performs the following high-level steps in this given order:
- Validates that a search profile is provided by calling SolrSearchProfileNameValidator and immediately stops if none is provided.
- Validates the corresponding index name by calling SolrSearchIndexNameValidator and immediately stops if invalid.
- Validates the corresponding workspace information by calling SolrSearchWorkSpaceValidator.
- Decodes _wcf.search.meta (if provided) and expands into _wcf.search.internal.meta by calling SolrSearchDecodeMetaTokenExpressionProvider. The value in this control parameter can be considered the breadcrumb trail.
- Calls each of the given expression providers defined in the search profile. For example, the
keyword search request involves using the IBM_findCatalogEntryByNameAndShortDescription search
profile. The following expression providers are run in the following sequence:
- SolrSearchBasedMerchandisingExpressionProvider calls the marketing component to run search rules.
- SolrSearchTermAssociationExpressionProvider gets synonyms and replaces the search term to fetch the final result.
- SolrSearchByKeywordRelevancyExpressionProvider handles the search by keyword request.
- SolrSearchByCategoryExpressionProvider handles the search by category, considering the sales catalog in the current business context.
- SolrSearchByManufacturerExpressionProvider handles the search by brand name requests.
- SolrSearchByPriceExpressionProvider handles the search by price range request generated from the Advanced Search page.
- SolrSearchByFacetExpressionProvider handles the search by facet request.
- SolrSearchByStorePathExpressionProvider generates conditions to handle the store path.
- SolrSearchByPublishedEntryOnlyExpressionProvider generates conditions for restricting search results to only published entries.
- SolrSearchByCustomExpressionProvider includes custom expressions stored in _wcf.search.expr.
- SolrSearchFacetConditionExpressionProvider generates a list of attribute-related facets and currency-specific price range facets for the current search request.
- SolrSearchTypeExpressionProvider handles the match type for keyword search requests, such as Any and Exclude SKU.
- SolrSearchSequencingExpressionProvider arranges product entries in the search result by ranking.
- SolrSearchProductEntitlementExpressionProvider performs product entitlement.
- SolrSearchInventoryExpressionProvider handles searching related to the Inventory index.
- Validates the search expression to ensure the query expression is not empty and does not contain special characters by calling SolrSearchExpressionValidator;
- Reconstructs and encodes the new meta string in _wcf.search.meta by calling SolrSearchEncodeMetaTokenExpressionProvider so that it can be reused later to represent the current navigation state.
The default SearchExpressionProcessor then composes the final Solr expression and sets up all the required bootstrap settings for communicating to the Solr search server. The result set is then mediated into an EntityContainer object to be returned to the caller.
The expression processor performs the following high-level steps in the following sequence:- Injects a debug parameter option into the SolrQuery object by calling SolrSearchDebugQueryPreprocessor.
- Includes a relevancy score and additional tracing information into the SolrQuery object by calling SolrSearchPreviewQueryPreprocessor.
- Enables spell correction and includes its associated parameter options into the SolrQuery object by calling SolrSearchSpellCorrectionQueryPreprocessor.
- Enables highlighting and includes its associated parameter options into the SolrQuery object by calling SolrSearchHighlighterQueryPreprocessor.
- Injects pagination parameter options into the SolrQuery object by calling SolrSearchPaginationQueryPreprocessor.
- Injects sorting parameter options into the SolrQuery object by calling SolrSearchSortingQueryPreprocessor.
- Injects result grouping parameter options into the SolrQuery object by calling SolrSearchResultGroupingQueryPreprocessor.
- Generates a list of index fields to be included in the search result set by calling SolrSearchResultFieldQueryPreprocessor.
- Composes a list of facet fields, with the proper settings, to be included in the search result set by calling SolrSearchFacetQueryPreprocessor.
- Injects the main search query string into the SolrQuery object by calling SolrSearchMainQueryPreprocessor.
- Launches a list of search query preprocessors defined in the given search profile to allow modifying of the SolrQuery object immediately before sending it to the Solr server for processing.
- Attempts to connect to the Solr server, with retry logic enabled upon connection failures, to process the SolrQuery object.
- Launches a list of search query postprocessors defined in the given search profile to allow modifying of the physical data object, SolrEntityContainerImpl, immediately after the QueryResponse is returned from the Solr server.
- The response of the search request is a native search response object, the physical SDO com.ibm.commerce.catalog.facade.server.services.search.metadata.solr.SolrCatalogNavigationViewImpl,
which is mediated by the Catalog navigation business object mediator (defined in
wc-business-object-mediator.xml) into the Catalog navigation noun (CatalogNavigationView). This
message transformation is implemented by the following mediators:
- SolrReadCatalogNavigationViewMediator
- The top-level mediator for processing the facets and metadata, such as spelling correction and meta strings.
- SolrReadCatalogEntryViewPartMediator
- The CatalogEntryView noun part mediator for processing all required CatalogEntryView nouns in the list in the CatalogNavigationView noun.
- SolrReadCatalogGroupViewPartMediator
- The CatalogGroupView noun part mediator for processing all required CatalogGroupView nouns in the list in the CatalogNavigationView noun.
- SolrReadAttachmentAssetViewPartMediator
- Constructs the AttachmentAssetViewType from the search result document list and puts those attachments into the CatalogEntryViewType container. If the catentry_id is found in the noun container, it puts the attachment object in it. If the catentry_id is not found in the noun container, it creates a new CatalogEntryViewType and puts the attachment into it.
- SolrReadBreadCrumbTrailViewPartMediator
- Converts the result set data from Solr into its logical manifestations in the logical
CatalogNavigationViewType noun. This mediator handles the
/CatalogNavigationView/BreadCrumbTrailView
portion of the noun. - SolrReadFacetViewPartMediator
- Converts the result set data from Solr into its logical manifestations in the logical
CatalogNavigationViewType noun. This mediator handles the
/CatalogNavigationView/FacetView
portion of the noun. - SolrReadWebContentViewPartMediator
- Converts the result set data from Solr into its logical manifestations in the logical
CatalogNavigationViewType noun. This mediator handles the
/CatalogNavigationView/CatalogEntryView
portion of the noun. - SolrReadCatalogNavigationViewPostMediator
- Performs any post mediation logic to the logical CatalogNavigationViewType noun.Important: This mediator must be declared as the last entry in the wc-business-object-mediator.xml file.
Note: A list of mediator properties are defined under the mediator section to provide a runtime mapping from the search index field name to an XPath in the logical noun.