summaryrefslogtreecommitdiffstats
path: root/src/Plugin/search_api/data_type/TextDataType.php
blob: eeb104343df9f0fab57d33273ce93754a4738039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace Drupal\search_api\Plugin\search_api\data_type;

use Drupal\search_api\DataType\DataTypePluginBase;
use Drupal\search_api\Plugin\search_api\data_type\value\TextValue;

/**
 * Provides a full text data type.
 *
 * This data type uses objects of type
 * \Drupal\search_api\Plugin\search_api\data_type\value\TextValueInterface for
 * its values.
 *
 * The same is expected of all data types that specify this type as their
 * fallback.
 *
 * @see \Drupal\search_api\Plugin\search_api\data_type\value\TextValueInterface
 *
 * @SearchApiDataType(
 *   id = "text",
 *   label = @Translation("Fulltext"),
 *   description = @Translation("Fulltext fields are analyzed fields which are made available for fulltext search. This data type should be used for any fields (usually with free text input by users) which you want to search for individual words."),
 *   default = "true"
 * )
 */
class TextDataType extends DataTypePluginBase {

  /**
   * {@inheritdoc}
   */
  public function getValue($value) {
    return new TextValue((string) $value);
  }

}