class SarniaSearchApiSolrField in Sarnia 7
Extend the logic around Solr field schema information.
Hierarchy
- class \SearchApiSolrField
- class \SarniaSearchApiSolrField
Expanded class hierarchy of SarniaSearchApiSolrField
File
- ./
solr_field.inc, line 6
View source
class SarniaSearchApiSolrField extends SearchApiSolrField {
/**
* @var string
* The name of the field.
*/
protected $name;
/**
* Constructor.
*
* @param stdClass $field
* A field object from Solr's "Luke" servlet.
*/
public function __construct(SearchApiSolrField $field, $name = NULL) {
$this->field = $field->field;
$this->name = $name;
}
/**
* Get the name of the Solr field.
*
* @return string
* The name of the Solr field.
*/
public function getName() {
return $this->name;
}
/**
* Determine whether this field may be suitable for use as a key field.
*
* Unfortunately, it seems like the best way to find an actual uniqueKey field
* according to Solr is to examine the Solr core's schema.xml.
*
* @return boolean
* Whether the field is suitable for use as a key.
*/
public function isPossibleKey() {
return !$this
->getDynamicBase() && $this
->isStored() && !$this
->isMultivalued();
}
/**
* 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 boolean
* Whether the field might be suitable for sorting.
*/
public function isSortable() {
return $this
->isIndexed() && !$this
->isMultivalued();
}
/**
* Determine whether a field is suitable for fulltext search.
*
* Some fields are tokenized for sort and contain a single, all lowercase
* value. These fields are not suitable for fulltext search, but there is no
* general way to tell them apart from fields that are tokenized into multiple
* terms.
*
* @see SearchApiSolrField::isSortable()
*
* @return boolean
* Whether the field might be suitable for fulltext search.
*/
public function isFulltextSearchable() {
return $this
->isIndexed() && $this
->isTokenized();
}
/**
* Determine whether a field is suitable for filtering (non-fulltext, case sensitive search).
*
* When searching on this type of field, only full, exact values will match.
*
* @return boolean
* Whether the field might be suitable for filtering.
*/
public function isFilterable() {
return $this
->isIndexed() && !$this
->isTokenized();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SarniaSearchApiSolrField:: |
protected | property | The name of the field. | |
SarniaSearchApiSolrField:: |
public | function | Get the name of the Solr field. | |
SarniaSearchApiSolrField:: |
public | function | Determine whether a field is suitable for filtering (non-fulltext, case sensitive search). | |
SarniaSearchApiSolrField:: |
public | function | Determine whether a field is suitable for fulltext search. | |
SarniaSearchApiSolrField:: |
public | function |
Determine whether this field may be suitable for use as a key field. Overrides SearchApiSolrField:: |
|
SarniaSearchApiSolrField:: |
public | function |
Determine whether a field is suitable for sorting. Overrides SearchApiSolrField:: |
|
SarniaSearchApiSolrField:: |
public | function |
Constructor. Overrides SearchApiSolrField:: |
|
SearchApiSolrField:: |
protected | property | The original field object. | |
SearchApiSolrField:: |
protected | property | An array of schema properties for this field. This will be a subset of the SearchApiSolrField::schemaLabels array. | |
SearchApiSolrField:: |
public static | property | Human-readable labels for Solr schema properties. | |
SearchApiSolrField:: |
public | function | Gets the "dynamic base" of this field. | |
SearchApiSolrField:: |
public | function | Gets the raw information of the field. | |
SearchApiSolrField:: |
public | function | Gets an array of field properties. | |
SearchApiSolrField:: |
public | function | Gets the type of the Solr field, according to the Solr schema. | |
SearchApiSolrField:: |
public | function | Determines whether this field is binary. | |
SearchApiSolrField:: |
public | function | Determines whether this field is compressed. | |
SearchApiSolrField:: |
public | function | Determines whether this field is indexed. | |
SearchApiSolrField:: |
public | function | Determines whether this field is lazy-loaded. | |
SearchApiSolrField:: |
public | function | Determines whether this field is multi-valued. | |
SearchApiSolrField:: |
public | function | Determines whether this field omits norms when indexing. | |
SearchApiSolrField:: |
public | function | Determines whether this field sorts missing entries first. | |
SearchApiSolrField:: |
public | function | Determines whether this field sorts missing entries last. | |
SearchApiSolrField:: |
public | function | Determines whether this field is stored. | |
SearchApiSolrField:: |
public | function | Determines whether this field has the "termOffsets" option set. | |
SearchApiSolrField:: |
public | function | Determines whether this field has the "termPositions" option set. | |
SearchApiSolrField:: |
public | function | Determines whether this field has stored term vectors. | |
SearchApiSolrField:: |
public | function | Determines whether this field is tokenized. |