Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
MatchExplorerQuery
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 setType
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 setQuery
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Wikibase\MediaInfo\Search;
4
5use Elastica\Query\AbstractQuery;
6
7/**
8 * Implementation of "match_explorer" query from ltr-query plugin
9 *
10 * @link https://github.com/o19s/elasticsearch-learning-to-rank
11 */
12class MatchExplorerQuery extends AbstractQuery {
13    public const TYPE_SUM_CLASSIC_IDF = 'sum_classic_idf';
14    public const TYPE_MEAN_CLASSIC_IDF = 'mean_classic_idf';
15    public const TYPE_MAX_CLASSIC_IDF = 'max_classic_idf';
16    public const TYPE_MIN_CLASSIC_IDF = 'min_classic_idf';
17    public const TYPE_STDDEV_CLASSIC_IDF = 'stddev_classic_idf';
18    public const TYPE_SUM_RAW_DF = 'sum_raw_df';
19    public const TYPE_MEAN_RAW_DF = 'mean_raw_df';
20    public const TYPE_MAX_RAW_DF = 'max_raw_df';
21    public const TYPE_MIN_RAW_DF = 'min_raw_df';
22    public const TYPE_STDDEV_RAW_DF = 'stddev_raw_df';
23    public const TYPE_SUM_RAW_TTF = 'sum_raw_ttf';
24    public const TYPE_MEAN_RAW_TTF = 'mean_raw_ttf';
25    public const TYPE_MAX_RAW_TTF = 'max_raw_ttf';
26    public const TYPE_MIN_RAW_TTF = 'min_raw_ttf';
27    public const TYPE_STDDEV_RAW_TTF = 'stddev_raw_ttf';
28    public const TYPE_UNIQUE_TERMS_COUNT = 'unique_terms_count';
29
30    public function __construct( string $type, AbstractQuery $query ) {
31        $this->setType( $type )
32            ->setQuery( $query );
33    }
34
35    /**
36     * @param string $type
37     * @return self
38     */
39    public function setType( string $type ) {
40        $this->setParam( 'type', $type );
41
42        return $this;
43    }
44
45    /**
46     * @param AbstractQuery $query
47     * @return self
48     */
49    public function setQuery( AbstractQuery $query ) {
50        $this->setParam( 'query', $query );
51
52        return $this;
53    }
54}