1 | <?php |
||
46 | class BookmarksProvider implements IFullTextSearchProvider { |
||
47 | |||
48 | |||
49 | const BOOKMARKS_PROVIDER_ID = 'bookmarks'; |
||
50 | |||
51 | /** @var ConfigService */ |
||
52 | private $configService; |
||
53 | |||
54 | /** @var BookmarksService */ |
||
55 | private $bookmarksService; |
||
56 | |||
57 | /** @var SearchService */ |
||
58 | private $searchService; |
||
59 | |||
60 | /** @var ElasticSearchService */ |
||
61 | private $elasticSearchService; |
||
62 | |||
63 | /** @var MiscService */ |
||
64 | private $miscService; |
||
65 | |||
66 | |||
67 | /** @var Runner */ |
||
68 | private $runner; |
||
69 | |||
70 | |||
71 | /** |
||
72 | * return unique id of the provider |
||
73 | */ |
||
74 | public function getId() { |
||
77 | |||
78 | |||
79 | /** |
||
80 | * return name of the provider |
||
81 | */ |
||
82 | public function getName() { |
||
85 | |||
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getVersion() { |
||
93 | |||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getAppId() { |
||
101 | |||
102 | |||
103 | /** |
||
104 | * @return array |
||
105 | */ |
||
106 | public function getConfiguration() { |
||
109 | |||
110 | |||
111 | public function setRunner(Runner $runner) { |
||
114 | |||
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getOptionsTemplate() { |
||
122 | |||
123 | |||
124 | /** |
||
125 | * called when loading all providers. |
||
126 | * |
||
127 | * Loading some containers. |
||
128 | * |
||
129 | * @throws QueryException |
||
130 | */ |
||
131 | public function loadProvider() { |
||
141 | |||
142 | |||
143 | /** |
||
144 | * returns all indexable document for a user. |
||
145 | * There is no need to fill the document with content at this point. |
||
146 | * |
||
147 | * $platform is provided if the mapping needs to be changed. |
||
148 | * |
||
149 | * @param string $userId |
||
150 | * |
||
151 | * @return BookmarksDocument[] |
||
152 | */ |
||
153 | public function generateIndexableDocuments($userId) { |
||
158 | |||
159 | |||
160 | /** |
||
161 | * generate documents prior to the indexing. |
||
162 | * throw NoResultException if no more result |
||
163 | * |
||
164 | * @param IndexDocument[] $chunk |
||
165 | * |
||
166 | * @return IndexDocument[] |
||
167 | */ |
||
168 | public function fillIndexDocuments($chunk) { |
||
175 | |||
176 | |||
177 | /** |
||
178 | * @param IndexDocument $document |
||
179 | * |
||
180 | * @return bool |
||
181 | */ |
||
182 | public function isDocumentUpToDate($document) { |
||
185 | |||
186 | |||
187 | /** |
||
188 | * @param Index $index |
||
189 | * |
||
190 | * @return BookmarksDocument|null |
||
191 | */ |
||
192 | public function updateDocument(Index $index) { |
||
195 | |||
196 | |||
197 | /** |
||
198 | * @param IFullTextSearchPlatform $platform |
||
199 | */ |
||
200 | public function onInitializingIndex(IFullTextSearchPlatform $platform) { |
||
203 | |||
204 | /** |
||
205 | * @param IFullTextSearchPlatform $platform |
||
206 | * @param array $arr |
||
207 | */ |
||
208 | public function onIndexingDocument(IFullTextSearchPlatform $platform, &$arr) { |
||
211 | |||
212 | /** |
||
213 | * @param IFullTextSearchPlatform $platform |
||
214 | */ |
||
215 | public function onResettingIndex(IFullTextSearchPlatform $platform) { |
||
218 | |||
219 | /** |
||
220 | * @param IFullTextSearchPlatform $platform |
||
221 | * @param SearchRequest $request |
||
222 | * @param array $arr |
||
223 | */ |
||
224 | public function onSearchingQuery( |
||
229 | |||
230 | |||
231 | /** |
||
232 | * not used yet |
||
233 | */ |
||
234 | public function unloadProvider() { |
||
236 | |||
237 | |||
238 | /** |
||
239 | * before a search, improve the request |
||
240 | * |
||
241 | * @param SearchRequest $request |
||
242 | */ |
||
243 | public function improveSearchRequest(SearchRequest $request) { |
||
246 | |||
247 | |||
248 | /** |
||
249 | * after a search, improve results |
||
250 | * |
||
251 | * @param SearchResult $searchResult |
||
252 | */ |
||
253 | public function improveSearchResult(SearchResult $searchResult) { |
||
258 | |||
259 | |||
260 | } |