Searcher::setFacettedTokens()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
3
/**
4
 * Created by PhpStorm.
5
 * User: gordon
6
 * Date: 25/3/2561
7
 * Time: 17:01 น.
8
 */
9
10
namespace Suilven\FreeTextSearch\Base;
11
12
use Suilven\FreeTextSearch\Container\SearchResults;
13
use Suilven\FreeTextSearch\Types\SearchParamTypes;
14
15
abstract class Searcher implements \Suilven\FreeTextSearch\Interfaces\Searcher
16
{
17
    /** @var array<string,string|int|float|bool> $filters */
18
    protected $filters = [];
19
20
    /** @var int */
21
    protected $pageSize = 15;
22
23
    /** @var int */
24
    protected $page = 1;
25
26
    /** @var string */
27
    protected $indexName;
28
29
    /** @var array<string,string> */
30
    protected $facettedTokens = [];
31
32
    /** @var array<string> */
33
    protected $hasManyTokens = [];
34
35
    /** @var string */
36
    protected $searchType = SearchParamTypes::AND;
37
38
39
    abstract public function search(?string $q): SearchResults;
40
41
42
    /** @param array<string,string|int|float|bool> $filters */
43
    public function setFilters(array $filters): void
44
    {
45
        $this->filters = $filters;
46
    }
47
48
49
    public function setPageSize(int $pageSize): void
50
    {
51
        $this->pageSize = $pageSize;
52
    }
53
54
55
    public function setIndexName(string $indexName): void
56
    {
57
        $this->indexName = $indexName;
58
    }
59
60
61
62
    /** @param array<string,string> $facettedTokens */
63
64
    public function setFacettedTokens(array $facettedTokens): void
65
    {
66
        $this->facettedTokens = $facettedTokens;
67
    }
68
69
70
    /** @param array<string> $hasManyTokens */
71
    public function setHasManyTokens(array $hasManyTokens): void
72
    {
73
        $this->hasManyTokens = $hasManyTokens;
74
    }
75
76
77
    public function setPage(int $pageNumber): void
78
    {
79
        $this->page = $pageNumber;
80
    }
81
82
83
    public function setSearchType(string $newSearchType): void
84
    {
85
        $this->searchType = $newSearchType;
86
    }
87
}
88