Concept - Implementing Search with SPARQUE


In the SPARQUE backend you manage all the elements needed to provide a great search or recommendations experience, among them the knowledge graph, the algorithms, and the (custom) APIs. 

To get results to the front end (or any other customer facing application), it can call the relevant API to get the results. The list of available endpoint sets and endpoints can be accessed in the backend. Documentation accompanying the endpoint set is also accessible via this page. SPARQUE users can create their own unique APIs. This concept focuses on the use of preconfigured default APIs. 

This concept describes how to use and combine specific endpoints to create various search functions, from search results and filters to search suggestions. 


Getting Started

Calls Explained

The SPARQUE endpoints consist of a number of elements.

For example, this call will give you a set of search results in which the content varies with the parameter values applied:




domain, this cannot be modified


/{SPARQUE version}








locale and other context parameters (valid for all parts of the call) *1




/e/{endpoint} or


/e/search/ or


parameter (valid for the specific endpoint) 

/p/{parameter}/value(s) or


/p/keyword/dvd or


type of request









default when omitted = 10




default when omitted = 0

*1: SPARQUE makes use of context parameters. It is recommended to place it at the start of the call, before a specific endpoint is called. See section Parameters.

Preconfigured APIs

With SPARQUE you build your own strategies and connect them to the endpoint in the API. Your SPARQUE environment has also a set of multiple preconfigured APIs which, if needed, can be modified.





Category suggestions which are found based on a keyword

When a user entered a keyword “lapto”, SPARQUE will suggest relevant categories such as “laptops”.


All categories including the levels which they are in

When you need to print the entire category tree


All facet names which are predefined

Those facet names are always visible on the list pages. Mostly used on top of the dynamic facets and easy to use for sorting the predefined facets.


Keyword suggestions which are found based on a keyword

When a user entered a keyword “lapto”, SPARQUE will suggest relevant keywords such as “laptop” or “laptop sleeves”.


All products

Mostly used in combination with a stacked call., e.g., all products within category X.


Product suggestions which are found based on a keyword

When a user entered a keyword “laptop”, SPARQUE will suggest relevant products such as “Lenovo Touch laptop”


All products which are found based on a keyword

Shows the result page with products after the user searched for “laptop”


Available sorting options

Show the sorting options of the result page

Preconfigured Stacked APIs

Stacking means the results of one call can be immediately used as the input for a next call. To retrieve relevant facets, for example, you need to know which products are returned in the result set. Stacking looks like the following, where two endpoints with their respective parameters are placed sequentially:


Stacking calls this way, the second part /e/facets... will use the results from the preceding endpoint /e/search/....




All facet names with values


All facet values


All products based on a clicked facet value


All facet names with values


All facet names


All facet values from the facet “brand”


All products based on a clicked brand facet value


All facet values from the facet “category”


All products based on a clicked category facet value


Sorts all products based on the product name (ascending)


Sorts all products based on the product name (descending)


The parameters are used to define values which are used within the strategies. An endpoint can have 0 to many parameters. Filling multiple parameters using the query API is done by appending them. SPARQUE makes use of context parameters. Context parameters hold for all further query endpoints in the URL. They can be specified at any location in the URL (even before the first query endpoint).

Because of the possibility that a locale parameter is needed in various parts of the call, it is recommended to place it at the start of the call, before a specific endpoint is called. That way, it will operate as a context parameter and be valid for various parts of the call rather than having to place it as a local parameter - behind a specific endpoint - multiple times. 






The keyword the user entered



Mostly used with a customer ID or a user ID



All the product SKUs which are in the shopping basket



The locale of the user or front end



The click values of the facet name to filter with



The facet name to filter with



Excludes any options from the most recently applied facet

Response Type




Gives the result of the request

Request Options




Name of the configuration to use (for example: default)


Counts the number of items returned


Offset on the number of items returned


Formatting of the results: json/xml/rdf/csv/xlsx. Default value is ‘json’

Product Objects 

For most of the use cases, the result set that is returned contains product objects. 

Products can be either masters or variants; each item is a product with its attributes. Masters are returned without reference to a mastered-product. When a result is a variant, it will be returned with reference to the master, see example below.

The item is the top-ranking variant (sku=6448771001). With the variant, the information about the master is also returned. It is the part that starts with "mastered-product", referring to "sku": "6448771". With this, you can choose what to display. You can use the image of the variant - this is very useful when, e.g., color is a variation - and combine that with the name of the master.

            "en-NZ":"GOPRO HELMET FRONT MOUNT, Black"
                  "en-NZ":" "
                  "en-NZ":"GOPRO HELMET FRONT MOUNT"

Search Implementation

Most websites make usage of a search bar and a result page. We will show which APIs are normally used for this and how they are implemented. We created screenshots with a wireframe. Within this wireframe we marked positions. We will explain which API is behind the mark and explain it with an example.

To make it more readable we define {{url}} as the elements {domain}{/version}/{workspace}/{api}.

For example:

This will be: {{url}}/c/locale/en-US/e/search/p/userId/1/p/keyword/dvd/p/cartId/1%281%29&7c1%282%29/results?config=default&count=30

Most search bars are used with 3 types of suggestions.

  • Keyword suggestions

  • Product suggestions

  • Category suggestions


When a user enters a keyword, this word is used as a parameter for keyword suggest, product suggest, and category suggest.

Keyword Suggest

These suggestions come from the API endpoint keywordsuggest.


  • {{url}}/e/keywordsuggest/p/keyword/laptop/results


The user enters the keyword “laptop”. We will get all relevant keyword suggestions related to that search term.

Product Suggest

These suggestions come from the API endpoint productsuggest.


  • {{url}}/e/productsuggest/p/keyword/laptop/results


The user enters the keyword “laptop”. We will get all relevant products related to that search term.

Category Suggest

These suggestions come from the API endpoint categorysuggest.


  • {{url}}/e/categorysuggest/p/keyword/laptop/results


The user enters the keyword “laptop”. We will get all relevant categories related to that search term.

Result Page

To show the result page, we need the API search.


  • {{url}}/c/locale/nl-NL/e/search/p/userId/none/p/stock/true/p/promotion/none/p/pinned/none/p/keyword/laptop/p/cartId/1(none)/results,count


We asked the API to provide the results for locale nl-NL, to show only products with stock and related to the keyword “laptop”. We do not have any data of userId, promotion, pinned and cartId parameters, so we filled in “none”.
The output will be products as objects (marked in orange border in the screenshot below).


By default, the results are limited to 10. To show more or less products, you can expand your request with the request options.

For example: (refer to the image above with 8 products on the first page)

  • {{url}}/c/locale/nl-NL/e/search/p/userId/none/p/stock/true/p/promotion/none/p/pinned/none/p/keyword/laptop/p/cartId/1(none)/results,count?count=8&offset=8


  • count will give the number of results (8)

  • offset will start the results from a rank (8), so the first 8 are skipped
    (Thus, it shows the second page of results.)

Sorting Options

With SPARQUE we have a default sorting on relevance. It is based on your own strategy. Sometimes you want to sort the results. In the standard set you can sort the results based on the product name (ascending and descending).

By default, you can request the defined sorting options.


  • {{url}}/e/sortings/p/locale/nl-NL/results


This will give you the possible sorting options. For example, with identifier “namedown”.

This value can be used to sort through a stacked API endpoint.


  • {{url}}/c/locale/nl-NL/e/search/p/userId/none/p/stock/true/p/promotion/none/p/pinned/none/p/keyword/laptop/p/cartId/1(none)/e/namedown/p/locale/nl-NL/results,count


This will sort the results from search on keyword “laptop” by the productname - descending.

Number of Search Results

Mostly the result page displays how many results are found related to a keyword.

To define the number of results, you have to add request options to the API.


  • {{url}}/c/locale/nl-NL/e/search/p/userId/none/p/stock/true/p/promotion/none/p/pinned/none/p/keyword/laptop/p/cartId/1(none)/e/namedown/p/locale/nl-NL/results,count


When we add a count after the results, the API will give information about the number of results. This will be at the end of the results and looks like this:

Show Filters

With SPARQUE it is possible to apply filters to the result set. Basically, there are two types of filters:

  • Predefined filters are best used for product attributes and relations that are (nearly) always present, such as brand and category. These filters will always be on display at a fixed position.

  • Dynamic filters are best used for product attributes and relations which are depending on the result set, such as color or hard disk storage. You only want to display them when they are relevant to display.

Predefined Filters

The advantage of defined facets is that each facet has its own definition. As a result, the score and the count may differ. For example, categories may be ranked in alphabetical order while brands are ranked by the number of products. For each predefined filter you will need to have a dedicated API endpoint.

Defined facets use predefined endpoints. Having a predefined endpoint implies that an endpoint can have its own strategy assigned to it. This way, the behavior of one defined facet can differ from the next one. To be able to use brand as a defined facet, there must be a corresponding endpoint called brand in the endpoint set that is called.

To know which defined facets are present in the workspace, you can call: /e/fixedFacets/... 

As default, there are two defined facets:

  • category

  • brand


  • {{url}}/e/fixedFacets/results


This will give all the predefined filters.

Get All Values of Predefined Filters

To get all values of a specified predefined filter, proceed as follows.


  • {{url}}/e/search/p/userId/none/p/stock/true/p/promotion/none/p/pinned/none/p/keyword/laptop/p/cartId/1(none)/e/category/p/locale/nl-NL/results,count


We added the stacked endpoint named “category”. Within this strategy we defined to determine the related categories based on the result set of “search”. The result set of the stacked endpoint “category” will be the relevant categories which can be used as a filter. See image below.

To get the brand options, stack ..../e/brand/... directly behind the call for search ....e/search/....., e.g.:


The part e/search/p/userId/1/p/keyword/printer/p/cartId/1(1) is the search call and /e/brand the stacked API to retrieve the options for brand. 

Alternatively, call: 


replacing ....e/brand/results with .../options/brand.

Note that the notations of the results are different between the two calls. The latter notation, /options/XYZ/... is preferred as it allows you to call multiple fixed facets in one group: 


The facets are separated by pipe sign or preferably %7c.

Filter on a Value of a Predefined Filters

To filter on one or more values of the facet brand, a filter is applied by stacking a call on top of the first call that provided the original result set:


where the part ....e/brand:FILTER/p/value/1(value1)%c1(value2).... is stacked to the preceding call for results ..e/search/p/....

  • e/brand:FILTER/ calls the brand filter

  • p/value determines which values the result set should be filtered on. Multiple values can be added by using the tuple notation "weight, openbracket, value, closebracket". Multiple values are separated by pipe sign or preferably %7c, e.g.,

To apply multiple filters, e.g., also a category filter, simply append:

...e/category:FILTER and appropriate values 


After the values have been selected to apply as filter, the new result set can be queried for facets and options:


Apply Multiselect on a Predefined Filter

When a user selects a filter the result set is, of course, based on your selection. This gives us a little problem on user experience. For example, you will filter on a certain category. Based on the selected filter the new result set has been requested to the API. Unless products are assigned to multiple categories, the products within the result set are not assigned to other categories anymore. The user now has no possiblity to click on other categories or to return to the previous results.

Adding the option multiselect=true will return the available options ignoring the last applied filter so that the options are not limited to the values that are present in the new result set. The feature multiselect=true is only available for defined facets. 


Dynamic Filters

Each product has many product properties. Some of these are not relevant enough to be displayed. SPARQUE is able to calculate which filter is relevant to be displayed. For example, if 80% of the products in a result set have the property 'diameter', it is probably relevant. If only 10% of the products have the 'diameter' property, it is probably not relevant. SPARQUE calculates on the fly which facets are relevant to the result set (so-called dynamic facets). Dynamic facets have the advantage that they can be called using a generic call. Unlike defined facets, a dynamic facet does not need to be defined as an endpoint in the backend.

To get all dynamic filters with the values, you can stack the endpoint strings_facets_options.


  • {{url}}/c/locale/nl-NL/e/search/p/userId/none/p/stock/true/p/promotion/none/p/pinned/none/p/keyword/laptop/p/cartId/1(none)/e/strings_facets_options/p/locale/nl-NL/results


This request will give you all property names with property values.

The output will be something like:

{    "offset": 0,    "count": 30,    "type": [        "STRING",        "STRING"    ],    "items": [        {            "rank": 1,            "probability": 347.0,            "tuple": [                "Colour_of_product",                "Black"            ]        },        {            "rank": 2,            "probability": 135.0,            "tuple": [                "USB 2.0 ports quantity",                "1"            ]        },        {            "rank": 3,            "probability": 128.0,            "tuple": [                "Plug and Play",                "Y"            ]        },        {            "rank": 4,            "probability": 116.0,            "tuple": [                "Internal",                "N"            ]        },

The probability indicates the amount of products associated with the facet value. There are 347 products with 'Colour_of_product' = 'Black'.

Filter by Value

After the call for the results and, if applicable, any filters already applied, you can stack a filter by appending 

...q/facet_filter/p/attribute/value1…valueX, with values in tuple notation to 


This will result in a product set with products having "weight" = "1100g" or "weight" = 350g.

To continue filtering on other attributes and values, simply keep appending filters: 


Apply Multiselect

Dynamic facets face the issue that once a filter has been applied, there is no way of knowing what preceded the filter. To make use of multiselect, you need to apply a workaround as the feature multiselect=true is only available for defined facets. There is no equivalent for dynamic facets. 

If the original call including filters is:


this will result in a product set with products having "weight" = "1100g" or "weight" = 350g.

You can call the facets and options after having received the filter results by appending .....e/strings_facets_options/... as follows:


However, calling the strings_facets_options at this point will obviously only return the values represented in the set, i.e. AFTER the filter for "Colour_of_product" = "Black" has been applied. In other words, no other options than "Black" can appear. What is to be done? When two filters have been applied in sequence, you want to reserve the multiple options of the last facet PRIOR to applying the last filter. 

Therefore, for multiselect, all facets and options may be called, EXCEPT THE ATTRIBUTE LAST APPLIED AS FILTER:


This call contains an 'except' parameter to exclude any options from the most recently applied facet.

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.
The Intershop Knowledge Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to if you experience login issues,
or if you want to register as customer.