You configure your relevance ranking strategy by exporting the content.xml file, editing this file to configure your relevance ranking strategy according to your requirements, and re-importing the file.

Follow these steps to configure your relevance ranking strategy:

  1. Run the following method to get an oauth access token; use the username and password that you use to log into the Commerce Cloud administration interface:

    curl -X POST --data "grant_type=password"& "username==$ADMIN_USERNAME"&"password=$ADMIN_PASSWORD" http://host:port/ccadmin/v1/login/

    The method above returns an access token in a response such as the following (greatly abbreviated):

    {"token_type":"bearer","access_token": "egNDtUrtpkocBK01Q=="}

  2. Use the OAuth access token in a method of the following form to perform an HTTP GET to access the resource that you want to configure:

    curl -H "Authorization: Bearer OAuth_access_token" http://host:port/gsadmin/v1/cloud.zip

    For example:

    curl –H "Authorization: Bearer egNDtUrtpkocBK01Q=="
    http://host:port/gsadmin/v1/cloud.zip

  3. Unzip the export file.

    $ mkdir cloud

    $ unzip -d cloud cloud.zip

  4. Edit the GuidedSearchService template, and add a relRankStrategy property to the resultsList cartridge, as shown below:

    $ vi ./cloud/pages/Default/services/guidedsearch/content.xml

    <ContentItem type="Page" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://endeca.com/schema/content/2008">
      <TemplateId>GuidedSearchService</TemplateId>
      <Property name="resultsList">
        <ContentItem type="ResultsList">
          <TemplateId>ResultsList</TemplateId>
          <Property name="relRankStrategy">
            <String>static(product.inStockMessage,ascending),nterms,
             maxfield,phrase,static(product.sortOrder,ascending)</String>
          </Property>
        </ContentItem>
      </Property>
    </ContentItem>

  5. Zip the guidedsearch service definition.

    $ pushd cloud/pages/Default/services/guidedsearch/
    $ zip -9r ../../../../../temp.zip .
    $ popd

  6. Import the ZIP file:

    $ curl -u "-H "Authorization:Bearer egNDtUrtpkocBK01Q"
    -F ":file=@temp.zip" http://host:port/sitespages/Default/services/guidedsearch

As soon as you import the relevance ranking strategy, the changes are visible in the preview storefront. To make the changes active in your live storefront, you must first publish the changes.

Important: Because the content.xml file will be replaced by a JSON interface in a coming release, Oracle recommends that you not build tools for interpreting and editing the content.xml files.


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices