Changing the relevancy of search index fields

Depending on your store catalog, some search index fields might be more relevant than others for when shoppers search in the store. You can fine-tune the relevancy of search index fields to improve search results that are based on your store catalog. The relevancy can be scoped to either the site level or to the category level.

The following table shows sample relevancy values assigned to search index fields:
Default relevancy values for search index fields
Search index field Default relevancy value
categoryname 100.0
partNumber_ntk 15.0
mfName 10.0
name 10.0
shortDescription 5.0
shortDesc_suggest 1.0
partNumber_suggest 1.0
name_suggest 1.0
defaultSearch 1.0
Tip: If your business users enter catalog information into the long description field instead of the short description, you might want to work around this issue by copying the information into the first few lines of the long description to quickly generate the short description. Then, boosting is applied accordingly to the short description.

Before you begin

Ensure that your site contains attribute dictionary attributes, marked as searchable or facetable, for which you want to change relevancy settings.

Procedure

  1. Run a keyword search in the storefront and identify the search results that you want to improve.
    For example, your catalog might result in displaying more relevant search results lower than you want them to appear.
  2. Update the SRCHPROPRELV table and change the relvalue for the search field you want to change the relevancy for:
    1. Run the following SQL statement:
      
      update srchproprelv set relvalue = rel_value 
      where srchproprelv_id in (select srchproprelv_id from srchproprelv 
      where indexfield in (select lower(srchfieldname) from attrdictsrchconf 
      where attr_id in (select attr_id from attr where identifier in ('identifier')))));
      Where:
      rel_value
      The relevancy value for the field. The default value is typically 1.0. To boost the field relative to the other default search index fields, enter a value greater than 1.0 for example, 10.0.
      identifier
      The field identifier for example, Color or Size.
  3. Perform the same keyword search again in the storefront and compare the search results with the initial search results. Continue to update search relevancy values to optimize the search results.

Example

Example 1: Changing the relevancy value of the Color and Size attributes at the site level to 10.0

update srchproprelv set relvalue = 10.0 
where srchproprelv_id in (select srchproprelv_id from srchproprelv 
where indexfield in (select lower(srchfieldname) from attrdictsrchconf 
where attr_id in (select attr_id from attr where identifier in ('Color', 'Size'))));
Example 2: Changing the relevancy value of the Color attribute at the Dresses category level:
  1. Query the information for colors in your store:
    select attrdict_id, storeent_id from attrdict where storeent_id=asset_store_id
    
    The returned attrdict_id value is then used in the following query:
    
    select * from srchproprelv
    where indexfield in (select srchfieldname from attrdictsrchconf
    where attr_id in (select attr_id from attr where identifier in ('Color') and attrdict_id=returned_attrdict_id));
    
    The values are:
    catalog ID
    10001
    storeent_id
    10051
    indexfield
    ads_f32
  2. Query the catgroup ID from CATGROUP:
    
    select * from catgroup c, storeent s 
    where c.member_id = s.member_id and storeent_id in 
    (select storeent_id from storecat where catalog_id=10001) 
    or storeent_id in (select RELATEDSTORE_ID from storerel 
    where STORE_ID in (select storeent_id from storecat 
    where catalog_id=10001) and STRELTYP_ID=-4) and c.identifier='Dresses';
    
    
    The resulting catgroup ID is 10006.
  3. Insert the new record into SRCHPROPRELV. For example, to increase the relevance to 10.5:
    Note: You must use a srchproprelv_id value that is less than -10000, as the upper range is reserved for IBM internal use.
    
    insert into srchproprelv (srchproprelv_id, catgroup_id, catalog_id, storeent_id, relvalue, indexfield)
    values (-10001,10006,10001,10051,10.5,'ads_f32');
    
Example 3: Getting the store ID to change the relevancy value for a specific store at a site or category level:

select storeent_id from storeent where identifier='identifier';
Example 4: Changing the default relevancy value before you load the default records into the SRCHPROPRELV table, or adding an index field
Note: The preceding relevancy values are loaded by the setupSearchIndex utility. Any updates to the default relevancy values in the relevancy.properties file must be made before you run the setupSearchIndex utility.
  1. Update the relevancy.properties file under WC_installdir\components\foundation\subcomponents\search\config
  2. The default relevancy.properties file contains the following values:
    
    categoryname=100.0
    name,mfName=10.0
    shortDescription,longDescription=5.0
    ads_f*,adi_f*,adf_f*,defaultSearch=1.0
    
    Where:
    • Each line contains an index field and its default relevancy value.
    • Search index fields are combined by using a comma (,) value.

    You can change the relevancy value for existing search index fields, or add new search index fields either by using new lines, or adding to an existing line.