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