Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
OpeningTextIndexField
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 getTextOptions
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace CirrusSearch\Search;
4
5/**
6 * Simple TextIndexField subclass useful to customize COPY_TO_SUGGEST
7 * @package CirrusSearch
8 */
9class OpeningTextIndexField extends TextIndexField {
10    /**
11     * Force COPY_TO_SUGGEST if CirrusSearchPhraseSuggestUseOpeningText
12     * is set.
13     * @param int $mappingFlags
14     * @return int
15     */
16    protected function getTextOptions( $mappingFlags ) {
17        $options = parent::getTextOptions( $mappingFlags );
18        if ( $this->config->get( 'CirrusSearchEnablePhraseSuggest' ) &&
19             $this->config->get( 'CirrusSearchPhraseSuggestUseOpeningText' )
20        ) {
21            $options |= self::COPY_TO_SUGGEST;
22        }
23        return $options;
24    }
25}