You are here

public function SarniaSearchApiSolrField::isSortable in Sarnia 7

Determine whether a field is suitable for sorting.

In order for a field to yield useful sorted results in Solr, it must be indexed and not multivalued. If a sort field is tokenized, the tokenization must yield only one token; multiple tokens can result in unpredictable sort ordering. Unfortunately, there's no way to check whether a particular field contains values with multiple tokens.

Return value

boolean Whether the field might be suitable for sorting.

Overrides SearchApiSolrField::isSortable

File

./solr_field.inc, line 62

Class

SarniaSearchApiSolrField
Extend the logic around Solr field schema information.

Code

public function isSortable() {
  return $this
    ->isIndexed() && !$this
    ->isMultivalued();
}