Types in Makaira

Types in Makaira are interesting for those who want to use their own fields as a base for searching and filtering. To provide this function the data has to be delivered with the correct type, this can be ensured by using type suffixes which give hints for the conversion which can also be named casting or mapping.

For example, if you want to be able to set filters by the slider, you should choose the numeric type float or int.

The string handling is a bit more complex as Makaira offers multiple string types like short-, long-fields, or fields with proper names. Only the right choice of type will deliver the desired result.

The table contains all types with a short explanation about the use case.

Datatype

Type description

Suffix

Description

date

Fields with date formatting

_date

Used for values that contains date.

float

Fields with floating point numbers

_float

Represents numbers with decimal place.

int

Fields with integer values

_int

Represents whole number that can be positive, negative, or zero, but not fraction.

bool

Fields with boolean value

_bool

Boolean is used when one of two possible values needs to be choosen. For example, True or False.

str

Fields with text content

1._str_short
2._str_long
3._str_short_key
4._str_keyword

  1. Short description of a product
  2. Long description of a product
  3. Proper names such as Manufacturer name
  4. Useful for special applications where case sensitive proper names are important.

data storage only

Deactivate typing

_data_only

Useful for large objects that are not to be searched and for example are only used for output in the frontend.

{  
  ...
  // type: *_date
  "marketRelease": "2015-01-01T12:10:30Z"
  // type: *_float
  "specialRate_float": 1.258 
  // type: *_int
  "usageScore_int": 150,
  // type: *_bool
  "hasConfiguration_bool": true,
  // type: *_str_short
  "shortDesc_str_short: "A shorter text for the record",
  // type: *_str_long
  "longDesc_str_long": "A very long text can be written",
  // type: *_str_short_key
  "bundleManufacturer_str_short_key": "Bertrand",
  // type: *_str_keyword
  "bundle_str_keyword": "Probierpaket für Einsteiger",
  // type: *_data_only
  "bundle_data_only": {
    "bundleId": 49625,
    "options": {
      "101": "Glas",
      "102": "PVC",
      "103": "Wood"  
    },      
  },
  ... 
}

Other systems

🚧

Please be aware that some functionalities will not work when you do not use attributes, attributeStr, attributeInt, attributeFloat (see benfits of attributes ... )