SearchQuery   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 4
eloc 8
c 4
b 1
f 0
dl 0
loc 49
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLimit() 0 3 1
A addSearchTerm() 0 6 2
A setLimit() 0 5 1
1
<?php
2
/**
3
 * Class SearchQuery|SilverStripe\FullTextSearch\Search\Queries\SearchQuery provide backward compatibility help for
4
 * migrating from the old module
5
 *
6
 * @package SilverStripe\FullTextSearch\Search\Queries
7
 * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo
8
 * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy
9
 */
10
11
namespace SilverStripe\FullTextSearch\Search\Queries;
12
13
use Firesphere\SolrSearch\Queries\BaseQuery;
14
15
/**
16
 * Class SearchQuery
17
 * Cover any changes between the SilverStripe FulltextSearch module and the upgraded module
18
 *
19
 * @package SilverStripe\FullTextSearch\Search\Queries
20
 */
21
class SearchQuery extends BaseQuery
22
{
23
    /**
24
     * @var int Default page size
25
     */
26
    public static $default_page_size = 10;
27
28
    /**
29
     * A simple stub to cover changes between Solr Search modules
30
     *
31
     * @param string $text
32
     * @param null|array $fields
33
     * @param int $boost
34
     * @return $this
35
     * @deprecated please use {@link self::addTerm()}
36
     */
37 1
    public function addSearchTerm($text, $fields = [], int $boost = 0)
38
    {
39 1
        $fields = $fields ? (array)$fields : [];
40 1
        $this->addTerm($text, $fields, $boost);
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * Set the rows that are to be returned
47
     * Compatibility stub
48
     *
49
     * @param int $limit
50
     * @return $this
51
     * @deprecated please use {@link self::setRows()}
52
     */
53 1
    public function setLimit($limit): self
54
    {
55 1
        $this->rows = $limit;
56
57 1
        return $this;
58
    }
59
60
    /**
61
     * Get the rows that are to be returned
62
     * Compatibility stub
63
     *
64
     * @return int
65
     * @deprecated please use {@link self::getRows()}
66
     */
67 1
    public function getLimit(): int
68
    {
69 1
        return $this->rows;
70
    }
71
}
72