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    protected $typeName = 'text';
12
13    public function getMapping( \SearchEngine $engine ) {
14        $config = parent::getMapping( $engine );
15        $config['analyzer'] = 'short_text';
16        $config['search_analyzer'] = 'short_text_search';
17        // NOTE: these fields are not used for scoring yet. We should
18        // reevaluate these options to
19        // - norms => true
20        // if we plan to use such fields for scoring and:
21        // - index_options => 'offsets'
22        // if we plan to support highlighting
23        $config += [
24            // Omit the length norm because we use it only for filtering
25            'norms' => false,
26        ];
27        return $config;
28    }
29}