1 | <?php |
||
11 | class FulltextSearch extends DataSearch { |
||
12 | |||
13 | const SUPPORTED_DRIVERS = ['mysql', 'sqlite']; |
||
14 | |||
15 | /** @var string */ |
||
16 | private $_mode; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $_databaseDriver; |
||
20 | |||
21 | /** |
||
22 | * FulltextSearch constructor. |
||
23 | * @param array $searchableFields |
||
24 | * @param string|null $mode |
||
25 | */ |
||
26 | 4 | public function __construct(array $searchableFields = [], string $mode = null) |
|
32 | |||
33 | /** |
||
34 | * @param string $driver |
||
35 | * @return FulltextSearch |
||
36 | * @throws \RuntimeException |
||
37 | */ |
||
38 | 2 | public function forceDatabaseDriver(string $driver) : FulltextSearch |
|
49 | |||
50 | /** |
||
51 | * Set the mode for the full text search. |
||
52 | * Available modes: |
||
53 | * "IN NATURAL LANGUAGE MODE", "IN BOOLEAN MODE", "WITH QUERY EXPANSION" |
||
54 | * @see https://dev.mysql.com/doc/refman/5.7/en/fulltext-search.html |
||
55 | * |
||
56 | * @param string $mode |
||
57 | * @return FulltextSearch |
||
58 | */ |
||
59 | 1 | public function setMode(string $mode) : FulltextSearch |
|
65 | |||
66 | /** |
||
67 | * @param Builder $queryBuilder |
||
68 | * @param string $value |
||
69 | * @return void |
||
70 | */ |
||
71 | 3 | protected function _searchFields(Builder $queryBuilder, string $value) : void |
|
75 | |||
76 | /** |
||
77 | * This has to be improved. |
||
78 | * @param string $value |
||
79 | * @return string |
||
80 | */ |
||
81 | 3 | private function _getMatchQuery(string $value) : string |
|
97 | } |