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 | 5 | public function indices() |
|
39 | |||
40 | /** |
||
41 | * Returns an array of indices for this model. |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | 6 | public function getIndices() |
|
57 | |||
58 | /** |
||
59 | * Returns the model in algolia friendly array form. |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | 6 | public function getAlgoliaRecord() |
|
67 | 6 | ||
68 | /** |
||
69 | * Returns an unique identifier for the Model. |
||
70 | * |
||
71 | * @return int |
||
72 | */ |
||
73 | public function getObjectID() |
||
77 | 5 | ||
78 | /** |
||
79 | * @see AlgoliaManager::pushToIndices() |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function index() |
||
89 | 1 | ||
90 | /** |
||
91 | * @see AlgoliaManager::removeFromIndices() |
||
92 | * |
||
93 | * @return array |
||
94 | */ |
||
95 | public function removeFromIndices() |
||
101 | 1 | ||
102 | /** |
||
103 | * @see AlgoliaManager::updateInIndices() |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | public function updateInIndices() |
||
113 | 1 | ||
114 | /** |
||
115 | * @see AlgoliaManager::reindex() |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | public static function reindex() |
||
125 | 1 | ||
126 | /** |
||
127 | * @see AlgoliaManager::clearIndices() |
||
128 | * |
||
129 | * @return array |
||
130 | */ |
||
131 | public static function clearIndices() |
||
137 | 1 | ||
138 | /** |
||
139 | * @see AlgoliaManager::search() |
||
140 | * |
||
141 | * @param string $query |
||
142 | * @param null|array $searchParameters |
||
143 | * |
||
144 | * @return array |
||
145 | */ |
||
146 | public static function search($query, array $searchParameters = null) |
||
152 | 2 | ||
153 | /** |
||
154 | * Returns the AlgoliaManager Instance. |
||
155 | * |
||
156 | * @internal Marked as protected only to counter the problems with mocking. |
||
157 | * |
||
158 | * @return AlgoliaManager |
||
159 | */ |
||
160 | protected static function getAlgoliaManager() |
||
164 | } |
||
165 |