Skip to content

Data Types

Relewise supports a number of different data value types, namely: String, StringList, Double, DoubleList, Boolean, BooleanList, Multilingual, MultilingualCollection, Multicurrency, Object, and ObjectList.

For optimal performance and to minimize bugs during your implementation, ensure that you are using the right data type for each datakey. Consult the list below for usecase examples, or reach out to us for help.

String Data

Use string data for any texts that are not language-specific, and which do not require natural language processing in the interaction with the search. For language-specific texts that you want your users to search for, use Multilingual data or MultilingualCollection data instead.

Use Case Example

You want to attach a Product URL to the Relewise data, so you can retrieve it at a later time during or after the search.

Example of String Data

csharp
product.Data["ProductUrl"] = "https://example.com/shop/product/196-swimtrunks.html";

 

StringList Data

Use StringList for any field where you require a list of strings that are not language-specific. If the strings are language-specific, and/or you expect to employ natural language processing in the search for these strings, use MultilingualCollection instead.

Use Case Examples

You want to append a list of product IDs that are compatible with the product being shown, so you can retrieve it at a later time.

Example of StringList Data

csharp
product.Data["CompatibleWithProducts"] = new string[]{"p1", "p2", "p3"};

 

Double Data

Use Double data values to store numbers or values, particularly those used to faceting or for use in mathematical operations.

Use Case Examples

You want to emphasize products with a certain in-stock threshold, so you add StockCountto the product in order to set up a merchandising rule on the basis of stock count.

Example of Double Data

csharp
product.Data["StockCount"] = 19;

 

DoubleList Data

Use DoubleList data when you have multiple numeric data points for a given entity.

Use Case Examples

You retail containers for liquid, and want to detail the different sizes that a product comes in.

Example of DoubleList Data

csharp
product.Data["CompatibleVolumesInLiters"= new double[] { 124510 };

 

Boolean Data

Boolean data is mainly for fields used in merchandising or faceting.

Use Case Examples

You want to hide or bury products that are out of stock, so you add InStock as a Boolean field in order to set up a merchandising rule.

Example of Boolean Data

csharp
product.Data["InStock"] = True;

 

BooleanList Data

Use BooleanList data for when your products have a number of true/false conditions. It is primarily a tool for merchandising or faceting.

Example of BooleanList Data

csharp
product.Data["BooleanListProperty"= new bool[] { truefalsefalsetruetrue };

 

Multilingual Data

Multilingual data is used to contain language-specific strings that you want to be directly searchable by your users, such as Product Title, Description etc.

Use of Multilingual data ensures that Relewise performs natural language processing such as stemming and decompounding to the search, ensuring better results. Even for sites with a single language, the use of Multilingual Variables is encouraged.

Use Case Examples

You want your users to be able to search for the description of a product, so you set up Description as a Multilingual field.

Example of Multilingual Data

csharp
product.Data["Description"] = new Multilingual(
    new Multilingual.Value(english, "The short english description")
    );

 

MultilingualCollection Data

Use MultilingualCollection data when you have a field that contains a series of language-specific strings that you want to be directly searchable by your users.

Use of Multilingual data ensures that Relewise performs natural language processing such as stemming and decompounding to the search, ensuring better results. Even for sites with a single language, the use of Multilingual Variables is encouraged.

Use Case Examples

You have a site in English and in German, and you want to present your users with localized search and recommendation results.

Example of MultilingualCollection Data

csharp
product.Data["ShortDescription"] = new Multilingual(
    new Multilingual.Value(new Language("en"),
        "The short english description")
    new Multilingual.Value(new Language("ge"),
        "Die kurze deutsche Beschreibung")
    );

 

Multicurrency Data

Price data is stored as MultiCurrency data, which contains a string describing the name of the currency, and a double type data containing the price itself. Even when your site only uses a single currency, you should strive to employ MultiCurrency data.

Use Case Example

You have multiple currencies on your site, and want to display the correct currency according to your users' preference.

Example of Multicurrency Data

csharp
product.Data["InstallationPrice"] = new MultiCurrency(
    new Money(new Currency("DKK"), 300),
    new Money(new Currency("EUR"), 40)
);

 

Object and ObjectList

Use Objects to store different types of data that you want returned together in a request. An ObjectList can be useful for storing lists of data that you want to present together, and is commonly used for faceting.

Use Case Examples

You have a list of physical stores, and want to allow your users to sort a product by the amount in stock in a certain store. So you make an ObjectList with storeId and stockAmount in each object.

Example of an ObjectList

csharp
product.Data["Stores"] = new DataObject[] {
     new DataObject(new Dictionary<string, DataValue?>() {
        ["StoreId"] = "Store1",
        ["StockCount"] = 203,
        ["ConnectedWarehouses"] = new double[] { 1, 9, 22 } }),
     new DataObject(new Dictionary<string, DataValue?>() {
        ["StoreId"] = "Store2",
        ["StockCount"] = 53,
        ["ConnectedWarehouses"] = new double[] { 3, 2, 20 } }) 
    };

After integrating your entity data, you can find it in the Entities section of MyRelewise.

Don't know us? Don't worry - you can find more information about us, by visiting our main page www.relewise.com