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    /**
31     * @param string $type
32     * @param AbstractQuery $query
33     */
34    public function __construct( string $type, AbstractQuery $query ) {
35        $this->setType( $type )
36            ->setQuery( $query );
37    }
38
39    /**
40     * @param string $type
41     * @return self
42     */
43    public function setType( string $type ) {
44        $this->setParam( 'type', $type );
45
46        return $this;
47    }
48
49    /**
50     * @param AbstractQuery $query
51     * @return self
52     */
53    public function setQuery( AbstractQuery $query ) {
54        $this->setParam( 'query', $query );
55
56        return $this;
57    }
58}