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