Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

View Facet Validation

Byron Ruth edited this page May 15, 2013 · 4 revisions

2013-02-13 - Proposal Draft

Specification

This is an extension to the core validation spec.

Constraints

Use of field vs. concept

The field and concept properties are mutually exclusive since they may represent two different sets of data. If both are defined an error will occur.

Facet

sort

The sort direction of the data in ascending (asc) or descending (desc) order

sort_index

The index/position for the sort. This defines when the sort is applied for the facet. For example, the below facet list would display Color, Shape, and Texture data (in that order) sorted by Texture then by Color:

[{
    'field': 'store.product.color',
    'sort': 'desc',
    'sort_index': 1
}, {
    'field': 'store.product.shape'
}, {
    'field': 'store.product.texture',
    'sort': 'asc',
    'sort_index': 0
}]

If a sort direction, but no sort_index is specified for a facet, they are applied (in order) after all other explicitly defined sorts. For example, the below list would sort first by Shape then by Color then by Texture:

[{
    'field': 'store.product.color',
    'sort': 'asc'
}, {
    'field': 'store.product.shape',
    'sort': 'asc',
    'sort_index': 0
}, {
    'field': 'store.product.texture',
    'sort': 'desc'
}]

Warnings

  • FACET_NOT_ORDERABLE
    • The facet cannot be ordered.

Errors

  • FIELD_XOR_CONCEPT_REQUIRED
    • If both a field and concept are defined, this error will be returned denoting only one of the two may be defined.

Examples

Facet

{
    'concept': 4,
    'sort': 'desc',
    'sort_order': 0,
    'language': 'Pure Tone Average (PTA)'
}

View

Simply a list of facets.

[{
    'concept': 4,
    'sort': 'desc',
    'sort_index': 0,
    'language': 'Pure Tone Average (PTA)'
}, {
    ...
}]