public function SolrFieldDefinition::isSortable in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/TypedData/SolrFieldDefinition.php \Drupal\search_api_solr\TypedData\SolrFieldDefinition::isSortable()
- 8.2 src/TypedData/SolrFieldDefinition.php \Drupal\search_api_solr\TypedData\SolrFieldDefinition::isSortable()
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
bool Whether the field might be suitable for sorting.
Overrides SolrFieldDefinitionInterface::isSortable
File
- src/
TypedData/ SolrFieldDefinition.php, line 203
Class
- SolrFieldDefinition
- Defines a class for Solr field definitions.
Namespace
Drupal\search_api_solr\TypedDataCode
public function isSortable() {
return $this
->isIndexed() && !$this
->isMultivalued();
}