@@ -51,145 +51,145 @@ |
||
| 51 | 51 | interface IFullTextSearchManager { |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Register a IProviderService. |
|
| 56 | - * |
|
| 57 | - * @since 15.0.0 |
|
| 58 | - * |
|
| 59 | - * @param IProviderService $providerService |
|
| 60 | - */ |
|
| 61 | - public function registerProviderService(IProviderService $providerService); |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Register a IIndexService. |
|
| 65 | - * |
|
| 66 | - * @since 15.0.0 |
|
| 67 | - * |
|
| 68 | - * @param IIndexService $indexService |
|
| 69 | - */ |
|
| 70 | - public function registerIndexService(IIndexService $indexService); |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Register a ISearchService. |
|
| 74 | - * |
|
| 75 | - * @since 15.0.0 |
|
| 76 | - * |
|
| 77 | - * @param ISearchService $searchService |
|
| 78 | - */ |
|
| 79 | - public function registerSearchService(ISearchService $searchService); |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * returns true is Full Text Search is available (app is present and Service |
|
| 83 | - * are registered) |
|
| 84 | - * |
|
| 85 | - * @since 16.0.0 |
|
| 86 | - * |
|
| 87 | - * @return bool |
|
| 88 | - */ |
|
| 89 | - public function isAvailable(): bool; |
|
| 90 | - |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Add the Javascript API in the navigation page of an app. |
|
| 94 | - * Needed to replace the default search. |
|
| 95 | - * |
|
| 96 | - * @since 15.0.0 |
|
| 97 | - */ |
|
| 98 | - public function addJavascriptAPI(); |
|
| 99 | - |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Check if the provider $providerId is already indexed. |
|
| 103 | - * |
|
| 104 | - * @since 15.0.0 |
|
| 105 | - * |
|
| 106 | - * @param string $providerId |
|
| 107 | - * |
|
| 108 | - * @return bool |
|
| 109 | - */ |
|
| 110 | - public function isProviderIndexed(string $providerId): bool; |
|
| 111 | - |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Retrieve an Index from the database, based on the Id of the Provider |
|
| 115 | - * and the Id of the Document |
|
| 116 | - * |
|
| 117 | - * @since 15.0.0 |
|
| 118 | - * |
|
| 119 | - * @param string $providerId |
|
| 120 | - * @param string $documentId |
|
| 121 | - * |
|
| 122 | - * @return IIndex |
|
| 123 | - */ |
|
| 124 | - public function getIndex(string $providerId, string $documentId): IIndex; |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Create a new Index. |
|
| 129 | - * |
|
| 130 | - * This method must be called when a new document is created. |
|
| 131 | - * |
|
| 132 | - * @since 15.0.0 |
|
| 133 | - * |
|
| 134 | - * @param string $providerId |
|
| 135 | - * @param string $documentId |
|
| 136 | - * @param string $userId |
|
| 137 | - * @param int $status |
|
| 138 | - * |
|
| 139 | - * @return IIndex |
|
| 140 | - */ |
|
| 141 | - public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex; |
|
| 142 | - |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * Update the status of an Index. status is a bitflag, setting $reset to |
|
| 146 | - * true will reset the status to the value defined in the parameter. |
|
| 147 | - * |
|
| 148 | - * @since 15.0.0 |
|
| 149 | - * |
|
| 150 | - * @param string $providerId |
|
| 151 | - * @param string $documentId |
|
| 152 | - * @param int $status |
|
| 153 | - * @param bool $reset |
|
| 154 | - */ |
|
| 155 | - public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false); |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * Update the status of an array of Index. status is a bit flag, setting $reset to |
|
| 160 | - * true will reset the status to the value defined in the parameter. |
|
| 161 | - * |
|
| 162 | - * @since 15.0.0 |
|
| 163 | - * |
|
| 164 | - * @param string $providerId |
|
| 165 | - * @param array $documentIds |
|
| 166 | - * @param int $status |
|
| 167 | - * @param bool $reset |
|
| 168 | - */ |
|
| 169 | - public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false); |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Update an array of Index. |
|
| 173 | - * |
|
| 174 | - * @since 15.0.0 |
|
| 175 | - * |
|
| 176 | - * @param IIndex[] $indexes |
|
| 177 | - */ |
|
| 178 | - public function updateIndexes(array $indexes); |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * Search using an array as request. If $userId is empty, will use the |
|
| 182 | - * current session. |
|
| 183 | - * |
|
| 184 | - * @see ISearchService::generateSearchRequest |
|
| 185 | - * |
|
| 186 | - * @since 15.0.0 |
|
| 187 | - * |
|
| 188 | - * @param array $request |
|
| 189 | - * @param string $userId |
|
| 190 | - * @return ISearchResult[] |
|
| 191 | - */ |
|
| 192 | - public function search(array $request, string $userId = ''): array; |
|
| 54 | + /** |
|
| 55 | + * Register a IProviderService. |
|
| 56 | + * |
|
| 57 | + * @since 15.0.0 |
|
| 58 | + * |
|
| 59 | + * @param IProviderService $providerService |
|
| 60 | + */ |
|
| 61 | + public function registerProviderService(IProviderService $providerService); |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Register a IIndexService. |
|
| 65 | + * |
|
| 66 | + * @since 15.0.0 |
|
| 67 | + * |
|
| 68 | + * @param IIndexService $indexService |
|
| 69 | + */ |
|
| 70 | + public function registerIndexService(IIndexService $indexService); |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Register a ISearchService. |
|
| 74 | + * |
|
| 75 | + * @since 15.0.0 |
|
| 76 | + * |
|
| 77 | + * @param ISearchService $searchService |
|
| 78 | + */ |
|
| 79 | + public function registerSearchService(ISearchService $searchService); |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * returns true is Full Text Search is available (app is present and Service |
|
| 83 | + * are registered) |
|
| 84 | + * |
|
| 85 | + * @since 16.0.0 |
|
| 86 | + * |
|
| 87 | + * @return bool |
|
| 88 | + */ |
|
| 89 | + public function isAvailable(): bool; |
|
| 90 | + |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Add the Javascript API in the navigation page of an app. |
|
| 94 | + * Needed to replace the default search. |
|
| 95 | + * |
|
| 96 | + * @since 15.0.0 |
|
| 97 | + */ |
|
| 98 | + public function addJavascriptAPI(); |
|
| 99 | + |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Check if the provider $providerId is already indexed. |
|
| 103 | + * |
|
| 104 | + * @since 15.0.0 |
|
| 105 | + * |
|
| 106 | + * @param string $providerId |
|
| 107 | + * |
|
| 108 | + * @return bool |
|
| 109 | + */ |
|
| 110 | + public function isProviderIndexed(string $providerId): bool; |
|
| 111 | + |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Retrieve an Index from the database, based on the Id of the Provider |
|
| 115 | + * and the Id of the Document |
|
| 116 | + * |
|
| 117 | + * @since 15.0.0 |
|
| 118 | + * |
|
| 119 | + * @param string $providerId |
|
| 120 | + * @param string $documentId |
|
| 121 | + * |
|
| 122 | + * @return IIndex |
|
| 123 | + */ |
|
| 124 | + public function getIndex(string $providerId, string $documentId): IIndex; |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Create a new Index. |
|
| 129 | + * |
|
| 130 | + * This method must be called when a new document is created. |
|
| 131 | + * |
|
| 132 | + * @since 15.0.0 |
|
| 133 | + * |
|
| 134 | + * @param string $providerId |
|
| 135 | + * @param string $documentId |
|
| 136 | + * @param string $userId |
|
| 137 | + * @param int $status |
|
| 138 | + * |
|
| 139 | + * @return IIndex |
|
| 140 | + */ |
|
| 141 | + public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex; |
|
| 142 | + |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * Update the status of an Index. status is a bitflag, setting $reset to |
|
| 146 | + * true will reset the status to the value defined in the parameter. |
|
| 147 | + * |
|
| 148 | + * @since 15.0.0 |
|
| 149 | + * |
|
| 150 | + * @param string $providerId |
|
| 151 | + * @param string $documentId |
|
| 152 | + * @param int $status |
|
| 153 | + * @param bool $reset |
|
| 154 | + */ |
|
| 155 | + public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false); |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * Update the status of an array of Index. status is a bit flag, setting $reset to |
|
| 160 | + * true will reset the status to the value defined in the parameter. |
|
| 161 | + * |
|
| 162 | + * @since 15.0.0 |
|
| 163 | + * |
|
| 164 | + * @param string $providerId |
|
| 165 | + * @param array $documentIds |
|
| 166 | + * @param int $status |
|
| 167 | + * @param bool $reset |
|
| 168 | + */ |
|
| 169 | + public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false); |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Update an array of Index. |
|
| 173 | + * |
|
| 174 | + * @since 15.0.0 |
|
| 175 | + * |
|
| 176 | + * @param IIndex[] $indexes |
|
| 177 | + */ |
|
| 178 | + public function updateIndexes(array $indexes); |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * Search using an array as request. If $userId is empty, will use the |
|
| 182 | + * current session. |
|
| 183 | + * |
|
| 184 | + * @see ISearchService::generateSearchRequest |
|
| 185 | + * |
|
| 186 | + * @since 15.0.0 |
|
| 187 | + * |
|
| 188 | + * @param array $request |
|
| 189 | + * @param string $userId |
|
| 190 | + * @return ISearchResult[] |
|
| 191 | + */ |
|
| 192 | + public function search(array $request, string $userId = ''): array; |
|
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | } |
@@ -48,194 +48,194 @@ |
||
| 48 | 48 | class FullTextSearchManager implements IFullTextSearchManager { |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** @var IProviderService */ |
|
| 52 | - private $providerService; |
|
| 53 | - |
|
| 54 | - /** @var IIndexService */ |
|
| 55 | - private $indexService; |
|
| 56 | - |
|
| 57 | - /** @var ISearchService */ |
|
| 58 | - private $searchService; |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @since 15.0.0 |
|
| 63 | - * |
|
| 64 | - * @param IProviderService $providerService |
|
| 65 | - */ |
|
| 66 | - public function registerProviderService(IProviderService $providerService) { |
|
| 67 | - $this->providerService = $providerService; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @since 15.0.0 |
|
| 72 | - * |
|
| 73 | - * @param IIndexService $indexService |
|
| 74 | - */ |
|
| 75 | - public function registerIndexService(IIndexService $indexService) { |
|
| 76 | - $this->indexService = $indexService; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @since 15.0.0 |
|
| 81 | - * |
|
| 82 | - * @param ISearchService $searchService |
|
| 83 | - */ |
|
| 84 | - public function registerSearchService(ISearchService $searchService) { |
|
| 85 | - $this->searchService = $searchService; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @since 16.0.0 |
|
| 90 | - * |
|
| 91 | - * @return bool |
|
| 92 | - */ |
|
| 93 | - public function isAvailable(): bool { |
|
| 94 | - if ($this->indexService === null || |
|
| 95 | - $this->providerService === null || |
|
| 96 | - $this->searchService === null) { |
|
| 97 | - return false; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - return true; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @return IProviderService |
|
| 106 | - * @throws FullTextSearchAppNotAvailableException |
|
| 107 | - */ |
|
| 108 | - private function getProviderService(): IProviderService { |
|
| 109 | - if ($this->providerService === null) { |
|
| 110 | - throw new FullTextSearchAppNotAvailableException('No IProviderService registered'); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - return $this->providerService; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * @return IIndexService |
|
| 119 | - * @throws FullTextSearchAppNotAvailableException |
|
| 120 | - */ |
|
| 121 | - private function getIndexService(): IIndexService { |
|
| 122 | - if ($this->indexService === null) { |
|
| 123 | - throw new FullTextSearchAppNotAvailableException('No IIndexService registered'); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - return $this->indexService; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * @return ISearchService |
|
| 132 | - * @throws FullTextSearchAppNotAvailableException |
|
| 133 | - */ |
|
| 134 | - private function getSearchService(): ISearchService { |
|
| 135 | - if ($this->searchService === null) { |
|
| 136 | - throw new FullTextSearchAppNotAvailableException('No ISearchService registered'); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - return $this->searchService; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * @throws FullTextSearchAppNotAvailableException |
|
| 145 | - */ |
|
| 146 | - public function addJavascriptAPI() { |
|
| 147 | - $this->getProviderService()->addJavascriptAPI(); |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * @param string $providerId |
|
| 153 | - * |
|
| 154 | - * @return bool |
|
| 155 | - * @throws FullTextSearchAppNotAvailableException |
|
| 156 | - */ |
|
| 157 | - public function isProviderIndexed(string $providerId): bool { |
|
| 158 | - return $this->getProviderService()->isProviderIndexed($providerId); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @param string $providerId |
|
| 164 | - * @param string $documentId |
|
| 165 | - * @return IIndex |
|
| 166 | - * @throws FullTextSearchAppNotAvailableException |
|
| 167 | - */ |
|
| 168 | - public function getIndex(string $providerId, string $documentId): IIndex { |
|
| 169 | - return $this->getIndexService()->getIndex($providerId, $documentId); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * @param string $providerId |
|
| 174 | - * @param string $documentId |
|
| 175 | - * @param string $userId |
|
| 176 | - * @param int $status |
|
| 177 | - * |
|
| 178 | - * @see IIndex for available value for $status. |
|
| 179 | - * |
|
| 180 | - * @return IIndex |
|
| 181 | - * @throws FullTextSearchAppNotAvailableException |
|
| 182 | - */ |
|
| 183 | - public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex { |
|
| 184 | - return $this->getIndexService()->createIndex($providerId, $documentId, $userId, $status); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * @param string $providerId |
|
| 190 | - * @param string $documentId |
|
| 191 | - * @param int $status |
|
| 192 | - * @param bool $reset |
|
| 193 | - * |
|
| 194 | - * @see IIndex for available value for $status. |
|
| 195 | - * |
|
| 196 | - * @throws FullTextSearchAppNotAvailableException |
|
| 197 | - */ |
|
| 198 | - public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false) { |
|
| 199 | - $this->getIndexService()->updateIndexStatus($providerId, $documentId, $status, $reset); |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * @param string $providerId |
|
| 204 | - * @param array $documentIds |
|
| 205 | - * @param int $status |
|
| 206 | - * @param bool $reset |
|
| 207 | - * |
|
| 208 | - * @see IIndex for available value for $status. |
|
| 209 | - * |
|
| 210 | - * @throws FullTextSearchAppNotAvailableException |
|
| 211 | - */ |
|
| 212 | - public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false) { |
|
| 213 | - $this->getIndexService()->updateIndexesStatus($providerId, $documentIds, $status, $reset); |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * @param IIndex[] $indexes |
|
| 219 | - * |
|
| 220 | - * @throws FullTextSearchAppNotAvailableException |
|
| 221 | - */ |
|
| 222 | - public function updateIndexes(array $indexes) { |
|
| 223 | - $this->getIndexService()->updateIndexes($indexes); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * @param array $request |
|
| 229 | - * @param string $userId |
|
| 230 | - * |
|
| 231 | - * @return ISearchResult[] |
|
| 232 | - * @throws FullTextSearchAppNotAvailableException |
|
| 233 | - */ |
|
| 234 | - public function search(array $request, string $userId = ''): array { |
|
| 235 | - $searchRequest = $this->getSearchService()->generateSearchRequest($request); |
|
| 236 | - |
|
| 237 | - return $this->getSearchService()->search($userId, $searchRequest); |
|
| 238 | - } |
|
| 51 | + /** @var IProviderService */ |
|
| 52 | + private $providerService; |
|
| 53 | + |
|
| 54 | + /** @var IIndexService */ |
|
| 55 | + private $indexService; |
|
| 56 | + |
|
| 57 | + /** @var ISearchService */ |
|
| 58 | + private $searchService; |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @since 15.0.0 |
|
| 63 | + * |
|
| 64 | + * @param IProviderService $providerService |
|
| 65 | + */ |
|
| 66 | + public function registerProviderService(IProviderService $providerService) { |
|
| 67 | + $this->providerService = $providerService; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @since 15.0.0 |
|
| 72 | + * |
|
| 73 | + * @param IIndexService $indexService |
|
| 74 | + */ |
|
| 75 | + public function registerIndexService(IIndexService $indexService) { |
|
| 76 | + $this->indexService = $indexService; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @since 15.0.0 |
|
| 81 | + * |
|
| 82 | + * @param ISearchService $searchService |
|
| 83 | + */ |
|
| 84 | + public function registerSearchService(ISearchService $searchService) { |
|
| 85 | + $this->searchService = $searchService; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @since 16.0.0 |
|
| 90 | + * |
|
| 91 | + * @return bool |
|
| 92 | + */ |
|
| 93 | + public function isAvailable(): bool { |
|
| 94 | + if ($this->indexService === null || |
|
| 95 | + $this->providerService === null || |
|
| 96 | + $this->searchService === null) { |
|
| 97 | + return false; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + return true; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @return IProviderService |
|
| 106 | + * @throws FullTextSearchAppNotAvailableException |
|
| 107 | + */ |
|
| 108 | + private function getProviderService(): IProviderService { |
|
| 109 | + if ($this->providerService === null) { |
|
| 110 | + throw new FullTextSearchAppNotAvailableException('No IProviderService registered'); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + return $this->providerService; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * @return IIndexService |
|
| 119 | + * @throws FullTextSearchAppNotAvailableException |
|
| 120 | + */ |
|
| 121 | + private function getIndexService(): IIndexService { |
|
| 122 | + if ($this->indexService === null) { |
|
| 123 | + throw new FullTextSearchAppNotAvailableException('No IIndexService registered'); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + return $this->indexService; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * @return ISearchService |
|
| 132 | + * @throws FullTextSearchAppNotAvailableException |
|
| 133 | + */ |
|
| 134 | + private function getSearchService(): ISearchService { |
|
| 135 | + if ($this->searchService === null) { |
|
| 136 | + throw new FullTextSearchAppNotAvailableException('No ISearchService registered'); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + return $this->searchService; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * @throws FullTextSearchAppNotAvailableException |
|
| 145 | + */ |
|
| 146 | + public function addJavascriptAPI() { |
|
| 147 | + $this->getProviderService()->addJavascriptAPI(); |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * @param string $providerId |
|
| 153 | + * |
|
| 154 | + * @return bool |
|
| 155 | + * @throws FullTextSearchAppNotAvailableException |
|
| 156 | + */ |
|
| 157 | + public function isProviderIndexed(string $providerId): bool { |
|
| 158 | + return $this->getProviderService()->isProviderIndexed($providerId); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param string $providerId |
|
| 164 | + * @param string $documentId |
|
| 165 | + * @return IIndex |
|
| 166 | + * @throws FullTextSearchAppNotAvailableException |
|
| 167 | + */ |
|
| 168 | + public function getIndex(string $providerId, string $documentId): IIndex { |
|
| 169 | + return $this->getIndexService()->getIndex($providerId, $documentId); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * @param string $providerId |
|
| 174 | + * @param string $documentId |
|
| 175 | + * @param string $userId |
|
| 176 | + * @param int $status |
|
| 177 | + * |
|
| 178 | + * @see IIndex for available value for $status. |
|
| 179 | + * |
|
| 180 | + * @return IIndex |
|
| 181 | + * @throws FullTextSearchAppNotAvailableException |
|
| 182 | + */ |
|
| 183 | + public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex { |
|
| 184 | + return $this->getIndexService()->createIndex($providerId, $documentId, $userId, $status); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * @param string $providerId |
|
| 190 | + * @param string $documentId |
|
| 191 | + * @param int $status |
|
| 192 | + * @param bool $reset |
|
| 193 | + * |
|
| 194 | + * @see IIndex for available value for $status. |
|
| 195 | + * |
|
| 196 | + * @throws FullTextSearchAppNotAvailableException |
|
| 197 | + */ |
|
| 198 | + public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false) { |
|
| 199 | + $this->getIndexService()->updateIndexStatus($providerId, $documentId, $status, $reset); |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @param string $providerId |
|
| 204 | + * @param array $documentIds |
|
| 205 | + * @param int $status |
|
| 206 | + * @param bool $reset |
|
| 207 | + * |
|
| 208 | + * @see IIndex for available value for $status. |
|
| 209 | + * |
|
| 210 | + * @throws FullTextSearchAppNotAvailableException |
|
| 211 | + */ |
|
| 212 | + public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false) { |
|
| 213 | + $this->getIndexService()->updateIndexesStatus($providerId, $documentIds, $status, $reset); |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * @param IIndex[] $indexes |
|
| 219 | + * |
|
| 220 | + * @throws FullTextSearchAppNotAvailableException |
|
| 221 | + */ |
|
| 222 | + public function updateIndexes(array $indexes) { |
|
| 223 | + $this->getIndexService()->updateIndexes($indexes); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * @param array $request |
|
| 229 | + * @param string $userId |
|
| 230 | + * |
|
| 231 | + * @return ISearchResult[] |
|
| 232 | + * @throws FullTextSearchAppNotAvailableException |
|
| 233 | + */ |
|
| 234 | + public function search(array $request, string $userId = ''): array { |
|
| 235 | + $searchRequest = $this->getSearchService()->generateSearchRequest($request); |
|
| 236 | + |
|
| 237 | + return $this->getSearchService()->search($userId, $searchRequest); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | } |