Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 5
OpeningTextIndexField
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 5
 getTextOptions
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 5
<?php
namespace CirrusSearch\Search;
/**
 * Simple TextIndexField subclass useful to customize COPY_TO_SUGGEST
 * @package CirrusSearch
 */
class OpeningTextIndexField extends TextIndexField {
    /**
     * Force COPY_TO_SUGGEST if CirrusSearchPhraseSuggestUseOpeningText
     * is set.
     * @param int $mappingFlags
     * @return int
     */
    protected function getTextOptions( $mappingFlags ) {
        $options = parent::getTextOptions( $mappingFlags );
        if ( $this->config->get( 'CirrusSearchEnablePhraseSuggest' ) &&
             $this->config->get( 'CirrusSearchPhraseSuggestUseOpeningText' )
        ) {
            $options |= self::COPY_TO_SUGGEST;
        }
        return $options;
    }
}