1 | <?php |
||
11 | trait Searchable |
||
12 | { |
||
13 | /** |
||
14 | * @see \yii\base\ArrayableTrait::toArray() |
||
15 | * |
||
16 | * @param array $fields |
||
17 | * @param array $expand |
||
18 | * @param bool $recursive |
||
19 | */ |
||
20 | abstract public function toArray(array $fields = [], array $expand = [], $recursive = true); |
||
21 | |||
22 | /** |
||
23 | * @see \yii\db\BaseActiveRecord::getPrimaryKey() |
||
24 | * |
||
25 | * @param bool $asArray |
||
26 | */ |
||
27 | abstract public function getPrimaryKey($asArray = false); |
||
28 | |||
29 | /** |
||
30 | * An array of indices that this model uses. If none specified |
||
31 | * The name of the model will be used as the index. |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | 6 | public function indices() |
|
39 | |||
40 | /** |
||
41 | * Returns an array of indices for this model. |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | 7 | public function getIndices() |
|
57 | |||
58 | /** |
||
59 | * Returns the model in algolia friendly array form. |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | 7 | public function getAlgoliaRecord() |
|
69 | |||
70 | /** |
||
71 | * Returns an unique identifier for the Model. |
||
72 | * |
||
73 | * @return int |
||
74 | */ |
||
75 | 1 | public function getObjectID() |
|
79 | |||
80 | /** |
||
81 | * @see AlgoliaManager::pushToIndices() |
||
82 | * |
||
83 | 1 | * @return array |
|
84 | */ |
||
85 | 1 | public function index() |
|
91 | |||
92 | /** |
||
93 | * @see AlgoliaManager::removeFromIndices() |
||
94 | * |
||
95 | 1 | * @return array |
|
96 | */ |
||
97 | 1 | public function removeFromIndices() |
|
103 | |||
104 | /** |
||
105 | 1 | * @see AlgoliaManager::updateInIndices() |
|
106 | * |
||
107 | 1 | * @return array |
|
108 | */ |
||
109 | 1 | public function updateInIndices() |
|
115 | 1 | ||
116 | /** |
||
117 | 1 | * @see AlgoliaManager::reindex() |
|
118 | * |
||
119 | 1 | * @return array |
|
120 | 1 | */ |
|
121 | public static function reindex() |
||
127 | 1 | ||
128 | /** |
||
129 | 1 | * @see AlgoliaManager::clearIndices() |
|
130 | 1 | * |
|
131 | * @return array |
||
132 | */ |
||
133 | public static function clearIndices() |
||
139 | |||
140 | 5 | /** |
|
141 | * @see AlgoliaManager::search() |
||
142 | * |
||
143 | * @param string $query |
||
144 | * @param null|array $searchParameters |
||
145 | * |
||
146 | * @return array |
||
147 | */ |
||
148 | public static function search($query, array $searchParameters = null) |
||
154 | |||
155 | /** |
||
156 | * Returns the AlgoliaManager Instance. |
||
157 | * |
||
158 | * @return AlgoliaManager |
||
159 | * @throws \yii\base\InvalidConfigException |
||
160 | */ |
||
161 | private static function getAlgoliaManager() |
||
165 | } |
||
166 |