com.ibm.commerce.catalog.facade.server.services.search.suggestion.solr

Class AbstractNavigationSuggestion

  • java.lang.Object
    • com.ibm.commerce.catalog.facade.server.services.search.suggestion.solr.AbstractNavigationSuggestion
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      java.util.Map getProperties()
      This method returns the set of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
      abstract void populateSuggestion(java.lang.String profile, com.ibm.commerce.catalog.facade.datatypes.SuggestionViewType suggestionCategory)
      This method populates a single navigation suggestion category for use in the storefront.
      void setProperties(java.util.Map properties)
      This method sets the list of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractNavigationSuggestion

        public AbstractNavigationSuggestion()
    • Method Detail

      • getProperties

        public java.util.Map getProperties()

        This method returns the set of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.

        ie. <_config:param name="myCustomProperty" value="1000"/> The key in the properties map is 'myCustomProperty' and the value is '1000'.

        Specified by:
        getProperties in interface NavigationSuggestion
        Returns:
        Map The set of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
        See Also:
        getProperties()
      • setProperties

        public void setProperties(java.util.Map properties)

        This method sets the list of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.

        ie. <_config:param name="myCustomProperty" value="1000"/> The key in the properties map is 'myCustomProperty' and the value is '1000'.

        Specified by:
        setProperties in interface NavigationSuggestion
        Parameters:
        properties - The set of customizable properties that were defined as name-value pairs in the search configuration for a navigation suggestion handler.
        See Also:
        setProperties(Map)
      • populateSuggestion

        public abstract void populateSuggestion(java.lang.String profile,
                                                com.ibm.commerce.catalog.facade.datatypes.SuggestionViewType suggestionCategory)

        This method populates a single navigation suggestion category for use in the storefront.

        This method should return all possible values for this navigation suggestion category. (ie. All brands, categories, articles that will be used to aid navigation in the store)

        The object suggestionCategory must be populated with your suggestion category information for your navigation suggestion to be displayed on the storefront.

        In the storefront, the service is called to return all possible values for each navigation suggestion category. The storefront performs the filtering of the values as the customer types into the quick search box.

        Modifications to the storefront JSPs are required. See the information center for more information describing the storefront JSPs modifications.

        The JSPs requiring modification are:

        • CachedHeaderDisplay.jsp
        • CachedSuggestions.jsp
        • SearchSetup.jspf

        This method will need to fetch all values for this NavigationSugesstion category from a data source (typically the database or the search engine) and mediate this data into the suggestionCategory (com.ibm.commerce.catalog.facade.datatypes.SuggestionViewType) and its corresponding entries, (com.ibm.commerce.catalog.facade.datatypes.SuggestionEntryViewType).

        The following is a description of the SuggestionViewType and SuggestionEntryViewType objects that must be populated:

        The xml data structure looks like this:

        
            <_cat:SuggestionView>
              <_cat:Identifier>Brand</_cat:Identifier>
              <_cat:Label>Brand</_cat:Label>
              <_cat:Entry>
                <_cat:Name>MapleWear</_cat:Name>
                <_cat:Value>mfName_ntk_cs</_cat:Value>
                <_cat:Image>MapleWear</_cat:Image>
                <_cat:UserData>
                	<_wcf:UserDataField name="Count">418</_wcf:UserDataField>
                </_cat:UserData>
              </_cat:Entry>
              <_cat:Entry>
                <_cat:Name>Sharpson</_cat:Name>
                <_cat:Value>mfName_ntk_cs</_cat:Value>
                <_cat:Image>Sharpson</_cat:Image>
                <_cat:UserData>
                	<_wcf:UserDataField name="Count">20</_wcf:UserDataField>
                </_cat:UserData>
              </_cat:Entry>
            </_cat:SuggestionView>
         


        • SuggestionView -> Identifier:

          This is the identifier for this navigation suggestion category. It is pre-populated with the value specified in the wc-search.xml file for the handler name.
          (wc-search.xml: profile -> navigationSuggestion -> name)

        • SuggestionView -> Label:

          This is a language sensitive display name for this suggestion. It is displayed in the drop-down menu in the storefront as a suggestion category name. (ie. 'Brand' or 'Category' or 'Support')

          To determine the language to populate, the business context can be checked for the language in the current service request.
          ie. Integer iLangId = CatalogComponentHelper.getLanguageId();
        • SuggestionView -> Entry -> Name:

          This is a language sensitive display name for this suggestion entry. This area should be populated with a value for a value for a suggestion. (ie. 'Nike' or 'Adidas' or 'Puma')

          To determine the language to populate, the business context can be checked for the language in the current service request.
          ie. Integer iLangId = CatalogComponentHelper.getLanguageId();
        • SuggestionView -> Entry -> Value:

          This is the value for use with link building in the store. You should populate this area with values that help the store developer build a url for the desired behaviour when a customer clicks on one of your suggestion entries.

        • SuggestionView -> Entry -> Image:

          This is the path to a display image for this suggestion entry. Out of the box, the storefront JSP does not use this property.

        • SuggestionView -> Entry -> UserData -> UserDataField:

          This is a an area to put name-value pairs with custom data. The key and value in the map are under your control.

        The following is an example of how to create navigation suggestion entries (SuggestionEntryViewType) and populate them.

          // Get the list of suggestion entries
          List  suggestionEntries = suggestionCategory.getEntry();
          
          ...
          // Set the label
          suggestionCategory.setLabel(label);
          ...
          
          // Create and populate the entries
                SuggestionEntryViewType suggestionEntry = CatalogFactory.eINSTANCE.createSuggestionEntryViewType();
                com.ibm.commerce.foundation.common.datatypes.UserDataType userData = suggestionEntry.getUserData();
                if(userData==null) {
                  userData = CommerceFoundationFactory.eINSTANCE.createUserDataType();
                }
                suggestionEntry.setUserData(userData);
                // Populate suggestion entry
                // Name
                suggestionEntry.setName("My suggestion name");
                // Value
                suggestionEntry.setValue("My suggestion value to help the store developer build a URL for when a customer clicks on my suggestion");
                // Image
                suggestionEntry.setImage("My suggestion image");
                // User data
                Map userDataFields = userData.getUserDataField();
                userDataFields.put("myCustomProperty", "myCustomValue");
         
         
          // Finally, add this entry to the list of entries
                suggestionEntries.add(suggestionEntry);
         

        Specified by:
        populateSuggestion in interface NavigationSuggestion
        Parameters:
        profile - The search profile name.
        suggestionCategory - An instantiated SuggestionViewType object. You must populate this object with your suggestions. If this navigation suggestion handler was configured with a name, the identifier is pre-populated in the SuggestionViewType object.
        See Also:
        SuggestionViewType, SuggestionEntryViewType, populateSuggestion(String, SuggestionViewType)