public static function TestFieldsProcessorPlugin::createTokenizedText in Search API 8
Tokenizes the given string by splitting on space characters.
Parameters
string $value: The value to be tokenized.
float $score: (optional) The score to set for all tokens.
Return value
\Drupal\search_api\Plugin\search_api\data_type\value\TextValueInterface A text value object containing an array of tokens.
1 call to TestFieldsProcessorPlugin::createTokenizedText()
- FieldsProcessorPluginBaseTest::testProcessFieldsTokenized in tests/
src/ Unit/ Processor/ FieldsProcessorPluginBaseTest.php - Tests whether the processField() method operates correctly.
File
- tests/
src/ Unit/ Processor/ TestFieldsProcessorPlugin.php, line 44
Class
- TestFieldsProcessorPlugin
- Mimics a processor working on individual fields of items.
Namespace
Drupal\Tests\search_api\Unit\ProcessorCode
public static function createTokenizedText($value, $score = 1.0) {
$return = new TextValue($value);
$tokens = [];
foreach (explode(' ', $value) as $word) {
$tokens[] = Utility::createTextToken($word, $score);
}
$return
->setTokens($tokens);
return $return;
}