Scalar Features

The engine provides several ease-of-use features when working with scalar values and ranges.

When constructing a query request or dimensions, Transparensee’s scalar interval notation can be used. For more information on the feature, refer to Interval Notation.

Min/Max Values

To bound a dimension with valid values and to improve calculated relevance values, optional min and max attributes can be specified on a dimension. Values that fall outside min or max are not indexed. The attributes also hint at the scale of the dimension, used in the engine’s relevance calculation algorithms. They are both inclusive which can be disabled by setting the attributes minInclusive or maxInclusive to false.

For example:

<dimension id="user.age" type="integer" min="0" max="200"/>
<dimension id="user.age" type="integer" min="0" max="200" minInclusive="false"/>

Ranges

Double and Integer type dimensions can be used purely as scalar dimensions, but scalar ranges can be also be defined within a scalar dimension. These ranges are ideal for use with the drill down functionality offered by the Overview. For example, if you want to provide drill down functionality on an integer dimension named “bedroom” that represents the number of bedrooms in a real estate listing, you’d need to define ranges over which a user can drill down. Ranges are defined as elements under a scalar dimension where the id is an identifier for a range, and value is the range itself using Interval Notation:

The dimension definition here also shows how to create a scalar type dimension that supports faceting across a range of values defined using interval notation.

<dimension type="integer" id="bedroom">
    <element id="studio" value="[0,1)"/>
    <element id="1" value="[1,2)"/>
    <element id="2" value="[2,3)"/>
    <element id="3" value="[3,4)"/>
    <element id="4" value="[4,5)"/>
    <element id="5+" value="[5,]"/>
</dimension>

Once defined, a user could drill down on the ‘bedroom:5’ element, producing a result set containing all items that were >= 5. Alternatively, the could select ‘bedroom:3’ and produce a result set of items whose bedroom count is 3, or, more accurately, >= 3 and < 4.

Faceting

With the major exception of text type dimensions, keyword, tree and scalar dimension types can support query-time calculation of facet counts for drilldown interfaces. If the dimension declaration does not infer how to group the values, then the indexer will automatically try to create a bucket for each unique value it encounters.

Faceting is automatically supported for tree, ordered, mutex and keyword dimensions. Scalar type dimensions require that the facet buckets be declared using an element defining the range or values to facet. For more information on setting up a scalar type dimension for faceting, refer to Scalar Features.

For more information on creating a query with drill down facet counts, refer to Facets Criterion.

Example Dimension Definition XML

Using all of the above examples, the following is a valid dimension definition document:

<?xml version="1.0" encoding='UTF-8'?>
<dimensions>
<dimension id="user.education" type="ordered">
    <element id="0" name="None"/>
    <element id="1" name="High School"/>
    <element id="2" name="Some College"/>
    <element id="3" name="Associate's Degree"/>
    <element id="4" name="Bachelor's Degree"/>
    <element id="5" name="Master's Degree"/>
    <element id="6" name="PhD"/>
</dimension>
<dimension id="ethnicity" type="tree">
    <element id="0" name="Asian">
    <element id="1" name="Japanese"/>
    <element id="2" name="Vietnamese"/>
    <element id="3" name="Chinese"/>
    </element>
    <element id="4" name="Black"/>
    <element id="5" name="Caribbean"/>
    <element id="6" name="Caucasian / White">
    <element id="7" name="Eastern European"/>
    <element id="8" name="Western European"/>
    <element id="9" name="North American"/>
    <element id="10" name="Other Caucasian"/>
    </element>
    <element id="11" name="East Indian"/>
    <element id="12" name="Hispanic / Latino"/>
    <element id="13" name="Middle Eastern"/>
    <element id="14" name="Native American"/>
    <element id="15" name="Pacific Islands"/>
    <element id="16" name="Other"/>
</dimension>
<dimension id="user.gender" type="mutex">
    <element id="0" name="Male"/>
    <element id="1" name="Female"/>
</dimension>
<dimension id="user.age" type="integer"/>
<dimension id='user.join_date' type="integer"/>
<dimension id="user.height" type="double"/>
<dimension id="user.geoloc" type="geoloc" longitude="user.longitude"
    latitude="user.latitude"/>
<dimension id="user.aboutme" type="text"/>
</dimensions>