Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ShortTextIndexField
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getMapping
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace CirrusSearch\Search;
4
5/**
6 * Index field representing a short technical text.
7 * ShortText uses a language agnostic analyzer.
8 * @package CirrusSearch
9 */
10class ShortTextIndexField extends CirrusIndexField {
11    /** @inheritDoc */
12    protected $typeName = 'text';
13
14    /** @inheritDoc */
15    public function getMapping( \SearchEngine $engine ) {
16        $config = parent::getMapping( $engine );
17        $config['analyzer'] = 'short_text';
18        $config['search_analyzer'] = 'short_text_search';
19        // NOTE: these fields are not used for scoring yet. We should
20        // reevaluate these options to
21        // - norms => true
22        // if we plan to use such fields for scoring and:
23        // - index_options => 'offsets'
24        // if we plan to support highlighting
25        $config += [
26            // Omit the length norm because we use it only for filtering
27            'norms' => false,
28        ];
29        return $config;
30    }
31}