Integrating FACT-Finder Search via JSON / JSONP

The return structure of the JSON interface follows the XML structure closely, but here there are JavaScript objects and lists that you must query. To receive a JSON result, you must pass the format parameter with the value json:

$stringEscapeUtils.escapeHtml($body)

You can find the schema definition of the JSON return under the following URL:

$stringEscapeUtils.escapeHtml($body)

Result structure

{
  "searchResult": {
    "resultStatus": "resultsFound",
    "resultArticleNumberStatus": "noArticleNumberSearch",
    "fieldRoles": {
        "trackingProductNumber": "products_id",
        "brand": "manufacturers_name",
        ...
    },
    "timedOut": false,
    "resultCount": 1238,
    "searchTime": 385,
    "simiFirstRecord": 9991,
    "simiLastRecord": 8791,
    "channel": "de",
    "searchParams": "... URL to current search result ...",

    "searchControlParams": {
      "disableCache": false,
      "generateAdvisorTree": false,
      "idsOnly": false,
      "useAsn": true,
      "useCampaigns": true,
      "useFoundWords": false,
      "useKeywords": true
    },

    "campaigns": [ ...This object holds information about the matching campaigns... ],

    "singleWordResults": null,

    "breadCrumbTrailItems": [
      {
        "associatedFieldName": null,
        "searchParams": "... URL to get back to this step ...",
        "text": "bmx",
        "type": "search",
        "value": "bmx"
      },
      ...
    ],

    "sortsList": [
      {
        "description": "sort.relevanceDescription",
        "name": null,
        "order": "desc",
        "searchParams": "... URL to select this sort option ...",
        "selected": true
      },
      ...
    ],

    "resultsPerPageList": [
      {
        "default": true,
        "selected": true,
        "value": 12,
        "searchParams": "...URL to select this results per page count..."
      },
      ...
    ],

    "paging": {
      "currentPage": 1,
      "pageCount": 104,
      "resultsPerPage": 12,
      "firstLink": {
        "caption": "1",
        "currentPage": false,
        "number": 1,
        "searchParams": "... URL to first page ..."
      },
      "lastLink": { ... Object for last page ... },
      "previousLink": {... Object for previous page ... },
      "nextLink": {... Object for next page ... },
      "pageLinks": [
        {
          "caption": "1",
          "currentPage": true,
          "number": 1,
          "searchParams": "... URL to page link ..."
        },
        ...
      ]
    },

    "groups": [
        ...
    ],

    "filters": [
        {
            "name": "category",
            "substring": false,
            "valueList": [
                {
                    "exclude": false,
                    "type": "or",
                    "value": "299"
                }
            ]
        }
    ],

    "records": [
      {
        "position": 1,
        "id": "221910",
        "searchSimilarity": 99.91,
        "simiMalusAdd": 0,
        "foundWords": [],
        "keywords": [... List with SEO keywords ...],
        "record": {
          "products_retail_price": "299.99",
          "category0": "Bikes",
          ... other fields as key-value-pair ...
        }
      },
      ...
     ]
}
Please note, that the parameter generateAdvisorTree has no effect and only exists for compatibility reasons. The advisor tree originally generated through the parameter is now always created and delivered with the search result (provided an advisor campaign is active).

As the interface is URL-based, the secondary searchParams elements contain URLs. In the case of filter objects, for example, this is the URL you must submit in order to filter the corresponding value or to remove the filter.

Status information

The keys resultStatus and resultArticleNumberStatus indicate whether or not a result has been found and whether or not an article number search was carried out (as well as its status). Possible values are resultsFound, nothingFound, errorOccured and noArticleNumberSearch (only resultArticleNumberStatus).

If a timeout occurred during the search, you receive back true as the value of timedOut. Searches that have timed out have been aborted and may possibly be incomplete.

In order to track whether the search query has been received correctly by the FACT-Finder application, the information in channel (database name), searchParams (search result URL) and searchControlParams (options for displaying the search result) can be used.

The value of resultsCount shows the total number of results found. searchTime returns the search time required in ms. The numbers in simiFirstRecord and simiLastRecord provide information as to the similarity of the first and last records in the result. The value range extends from 0 to 10000.

fieldRoles

Fields of the FACT-Finder product database can have roles. In this structure FACT-Finder reports which fields where configured for which role. Possible roles are:

  • brand – Brand field.
  • campaignProductNumber – Article number through which products can be refered to from the campaign manager.
  • deeplink – URL to product page.
  • description – Article description text.
  • displayProductNumber – Article number used whilde displaying the product.
  • ean – EAN
  • imageUrl – URL to product image.
  • price – Price field.
  • productName – Name of the product.
  • trackingProductNumber – Article number used for tracking.
  • masterArticleNumber – Article number of the main article for product variations.

The key is the respective role, the value is the field name. A field can occur multiple times if multiple roles where assigned to it.

campaigns

The objects returned in the key campaigns relate to the Campaign Manager Module. Details on this can be found in the associated documentation.

singleWordResults

   

"singleWordResults": [
      {
        "word": "rot",
        "recordCount": 513,
        "previewRecords": [{...list with records, see description below...}]
      },
      ...
    ],

If this feature is enabled and the search does not return a result, or the similarity of the best item falls below a set threshold, a search is conducted for the individual words of the search expression. The returned single-word objects have as their attributes the respective word (word), the number of hits achieved when searching for that word (recordCount), and optionally a certain number of products from the corresponding search result (previewRecords). Their structure is identical to the standard search results. However, the number of words returned is limited in a given configuration.

breadCrumbTrailItems

Objects that can be used to generate a bread crumb trail are provided here. Each object in this list corresponds to a step in the trail. The value in type allows you to determine what action this step led to. The name of the step, which corresponds to the search term or the filter value, can be found as the value of text. The value of the key searchParams is the URL that must be invoked to return to this point. If the action belongs to a field in the search database (such as a filter on a field), the name of the field is contained in the attribute associatedFieldName.

sortsList

Objects that can be used to generate a bread crumb trail are provided here. Each object in this list corresponds to a step in the trail. The value in type allows you to determine what action this step led to. The name of the step, which corresponds to the search term or the filter value, can be found as the value of text. The value of the key searchParams is the URL that must be invoked to return to this point. If the action belongs to a field in the search database (such as a filter on a field), the name of the field is contained in the attribute associatedFieldName.

resultsPerPageList

The Management Interface allows you to configure the maximum number of articles that should be shown on a results page. Each configured number will be returned as the value of one of these objects. The Boolean operator in selected indicates whether this value is selected, while the operator in default indicates whether this number is the default value. The URL in searchParams provides the URL for selection of the result set.

paging

The values that are returned here allow you to create the page navigation. The number of pages is given in pageCount, while the maximum number of results per page is in resultsPerPage. The current page number is contained in currentPage.

The items firstLink, lastLink, previousLink, nextLink and pageLinks return either an object or a list of objects, each of which describes a page link. These contain the text that should be shown for the page, as the value of the caption key. As a result, instead of showing the page number (1, 2, 3, etc.) it is also possible to generate the range of items (1-10, 11-20, etc.). Therefore this may differ from the value of number. The value of currentPage indicates whether the page is the one currently being displayed or not.

group

See ASN Integration for additional information.

filters

The filters contain the currently set filters. These can also be found from the selectedElements below group, but must be extracted from there. The filter provides all of the information in one place. This can be used to display all currently selected elements together, for example.

The filters are composed in accordance with the data structure in the FACT-Finder core and contain the following information: name contains the data fieldnames to which the filter is applied. The Boolean value in substring stipulates whether the filter has filtered the entire field or only needs to match part of the field. The valueList contains individual filter values in the form of objects. Each filter-value object contains the actual filter value (as a string) in value, a Boolean in exclude indicates whether the filter is negative (i.e. display all products that do not match this value) and type indicates how multiple filters are combined logically: inclusive (or) or exclusive (and).

records

In records you will find the search results that are to be shown on the selected page. Each search results object contains the ID of the product in the FACT-Finder database (id), its position in the results list (position), the calculated similarity to the search term (searchSimilarity), as well as the product importance devaluation (simiMalusAdd). There are many reasons why a product can be devalued; the most common are business rules. Each product’s field information can be found in record.

This list contains the field name and its value, as a pair. The values in keywords are supplied by the SEO Enhancer module, a detailed description of which can be found in the associated Integration documentation.

JSONP-Integration

In addition to the JSON interface, the JSONP interface allows you to pass the name of a callback method that can be called on the client system.

The JSONP interface is called using the parameter format=jsonp, with the method name passed in the callback parameter.

$stringEscapeUtils.escapeHtml($body)

You can use JSONP for all interfaces that support JSON.

Page Contents