class TextToken in Search API 8
Represents a single text token contained in a fulltext field's value.
Hierarchy
- class \Drupal\search_api\Plugin\search_api\data_type\value\TextToken implements TextTokenInterface
Expanded class hierarchy of TextToken
See also
\Drupal\search_api\Plugin\search_api\data_type\value\TextValueInterface
4 files declare their use of TextToken
- BackendTest.php in modules/
search_api_db/ tests/ src/ Kernel/ BackendTest.php - Database.php in modules/
search_api_db/ src/ Plugin/ search_api/ backend/ Database.php - FieldsProcessorPluginBaseTest.php in tests/
src/ Unit/ Processor/ FieldsProcessorPluginBaseTest.php - Utility.php in src/
Utility/ Utility.php
File
- src/
Plugin/ search_api/ data_type/ value/ TextToken.php, line 10
Namespace
Drupal\search_api\Plugin\search_api\data_type\valueView source
class TextToken implements TextTokenInterface {
/**
* The actual text value of this token.
*
* @var string
*/
protected $text;
/**
* The boost value for this token.
*
* @var float
*/
protected $boost = 1.0;
/**
* Constructs a TextToken object.
*
* @param string $text
* The text value of the token.
* @param float $boost
* (optional) The boost for the token.
*/
public function __construct($text, $boost = 1.0) {
$this->text = $text;
$this->boost = $boost;
}
/**
* {@inheritdoc}
*/
public function getText() {
return $this->text;
}
/**
* {@inheritdoc}
*/
public function setText($text) {
$this->text = $text;
return $this;
}
/**
* {@inheritdoc}
*/
public function getBoost() {
return $this->boost;
}
/**
* {@inheritdoc}
*/
public function setBoost($boost) {
$this->boost = $boost;
return $this;
}
/**
* Implements the magic __toString() method.
*/
public function __toString() {
return $this
->getText();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TextToken:: |
protected | property | The boost value for this token. | |
TextToken:: |
protected | property | The actual text value of this token. | |
TextToken:: |
public | function |
Retrieves the boost for this token. Overrides TextTokenInterface:: |
|
TextToken:: |
public | function |
Retrieves the text value of this token. Overrides TextTokenInterface:: |
|
TextToken:: |
public | function |
Sets the boost for this token. Overrides TextTokenInterface:: |
|
TextToken:: |
public | function |
Sets the text value of this token. Overrides TextTokenInterface:: |
|
TextToken:: |
public | function | Constructs a TextToken object. | |
TextToken:: |
public | function | Implements the magic __toString() method. |