@@ -80,225 +80,225 @@ |
||
| 80 | 80 | interface IFullTextSearchProvider { |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Must returns a unique Id used to identify the Content Provider. |
|
| 85 | - * Id must contains only alphanumeric chars, with no space. |
|
| 86 | - * |
|
| 87 | - * @since 15.0.0 |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function getId(): string; |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Must returns a descriptive name of the Content Provider. |
|
| 96 | - * This is used in multiple places, so better use a clear display name. |
|
| 97 | - * |
|
| 98 | - * @since 15.0.0 |
|
| 99 | - * |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 102 | - public function getName(): string; |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Should returns the current configuration of the Content Provider. |
|
| 107 | - * This is used to display the configuration when using the |
|
| 108 | - * ./occ fulltextsearch:check command line. |
|
| 109 | - * |
|
| 110 | - * @since 15.0.0 |
|
| 111 | - * |
|
| 112 | - * @return array |
|
| 113 | - */ |
|
| 114 | - public function getConfiguration(): array; |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Must returns a SearchTemplate that contains displayable items and |
|
| 119 | - * available options to users when searching. |
|
| 120 | - * |
|
| 121 | - * @see SearchTemplate |
|
| 122 | - * |
|
| 123 | - * @since 15.0.0 |
|
| 124 | - * |
|
| 125 | - * @return SearchTemplate |
|
| 126 | - */ |
|
| 127 | - public function getSearchTemplate(): SearchTemplate; |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Called when FullTextSearch is loading your Content Provider. |
|
| 132 | - * |
|
| 133 | - * @since 15.0.0 |
|
| 134 | - */ |
|
| 135 | - public function loadProvider(); |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * Set the wrapper of the currently executed process. |
|
| 140 | - * Because the index process can be long and heavy, and because errors can |
|
| 141 | - * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 142 | - * Content Provider to communicate with the process initiated by |
|
| 143 | - * FullTextSearch. |
|
| 144 | - * |
|
| 145 | - * The IRunner is coming with some methods so the Content Provider can |
|
| 146 | - * returns important information and errors to be displayed to the admin. |
|
| 147 | - * |
|
| 148 | - * @since 15.0.0 |
|
| 149 | - * |
|
| 150 | - * @param IRunner $runner |
|
| 151 | - */ |
|
| 152 | - public function setRunner(IRunner $runner); |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * This method is called when the administrator specify options when running |
|
| 157 | - * the ./occ fulltextsearch:index or ./occ fulltextsearch:live |
|
| 158 | - * |
|
| 159 | - * @since 15.0.0 |
|
| 160 | - * |
|
| 161 | - * @param IIndexOptions $options |
|
| 162 | - */ |
|
| 163 | - public function setIndexOptions(IIndexOptions $options); |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Returns all indexable document for a user as an array of IndexDocument. |
|
| 168 | - * |
|
| 169 | - * There is no need to fill each IndexDocument with content; at this point, |
|
| 170 | - * only fill the object with the minimum information to not waste memory while |
|
| 171 | - * still being able to identify the document it is referring to. |
|
| 172 | - * |
|
| 173 | - * FullTextSearch will call 2 other methods of this interface for each |
|
| 174 | - * IndexDocument of the array, prior to their indexing: |
|
| 175 | - * |
|
| 176 | - * - first, to compare the date of the last index, |
|
| 177 | - * - then, to fill each IndexDocument with complete data |
|
| 178 | - * |
|
| 179 | - * @see IndexDocument |
|
| 180 | - * |
|
| 181 | - * @since 15.0.0 |
|
| 182 | - * |
|
| 183 | - * @param string $userId |
|
| 184 | - * |
|
| 185 | - * @return IndexDocument[] |
|
| 186 | - */ |
|
| 187 | - public function generateIndexableDocuments(string $userId): array; |
|
| 188 | - |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * Called to verify that the document is not already indexed and that the |
|
| 192 | - * old index is not up-to-date, using the IIndex from |
|
| 193 | - * IndexDocument->getIndex() |
|
| 194 | - * |
|
| 195 | - * Returning true will not queue the current IndexDocument to any further |
|
| 196 | - * operation and will continue on the next element from the list returned by |
|
| 197 | - * generateIndexableDocuments(). |
|
| 198 | - * |
|
| 199 | - * @since 15.0.0 |
|
| 200 | - * |
|
| 201 | - * @param IndexDocument $document |
|
| 202 | - * |
|
| 203 | - * @return bool |
|
| 204 | - */ |
|
| 205 | - public function isDocumentUpToDate(IndexDocument $document): bool; |
|
| 206 | - |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Must fill IndexDocument with all information relative to the document, |
|
| 210 | - * before its indexing by the Search Platform. |
|
| 211 | - * |
|
| 212 | - * Method is called for each element returned previously by |
|
| 213 | - * generateIndexableDocuments(). |
|
| 214 | - * |
|
| 215 | - * @see IndexDocument |
|
| 216 | - * |
|
| 217 | - * @since 15.0.0 |
|
| 218 | - * |
|
| 219 | - * @param IndexDocument $document |
|
| 220 | - */ |
|
| 221 | - public function fillIndexDocument(IndexDocument $document); |
|
| 222 | - |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * The Search Provider must create and return an IndexDocument |
|
| 226 | - * based on the IIndex and its status. The IndexDocument must contains all |
|
| 227 | - * information as it will be send for indexing. |
|
| 228 | - * |
|
| 229 | - * Method is called during a cron or a ./occ fulltextsearch:live after a |
|
| 230 | - * new document is created, or an old document is set as modified. |
|
| 231 | - * |
|
| 232 | - * @since 15.0.0 |
|
| 233 | - * |
|
| 234 | - * @param IIndex $index |
|
| 235 | - * |
|
| 236 | - * @return IndexDocument |
|
| 237 | - */ |
|
| 238 | - public function updateDocument(IIndex $index): IndexDocument; |
|
| 239 | - |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * Called when an index is initiated by the administrator. |
|
| 243 | - * This is should only be used in case of a specific mapping is needed. |
|
| 244 | - * (ie. _almost_ never) |
|
| 245 | - * |
|
| 246 | - * @since 15.0.0 |
|
| 247 | - * |
|
| 248 | - * @param IFullTextSearchPlatform $platform |
|
| 249 | - */ |
|
| 250 | - public function onInitializingIndex(IFullTextSearchPlatform $platform); |
|
| 251 | - |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Called when administrator is resetting the index. |
|
| 255 | - * This is should only be used in case of a specific mapping has been |
|
| 256 | - * created. |
|
| 257 | - * |
|
| 258 | - * @since 15.0.0 |
|
| 259 | - * |
|
| 260 | - * @param IFullTextSearchPlatform $platform |
|
| 261 | - */ |
|
| 262 | - public function onResettingIndex(IFullTextSearchPlatform $platform); |
|
| 263 | - |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * Method is called when a search request is initiated by a user, prior to |
|
| 267 | - * be sent to the Search Platform. |
|
| 268 | - * |
|
| 269 | - * Your Content Provider can interact with the ISearchRequest to apply the |
|
| 270 | - * search options and make the search more precise. |
|
| 271 | - * |
|
| 272 | - * @see ISearchRequest |
|
| 273 | - * |
|
| 274 | - * @since 15.0.0 |
|
| 275 | - * |
|
| 276 | - * @param ISearchRequest $searchRequest |
|
| 277 | - */ |
|
| 278 | - public function improveSearchRequest(ISearchRequest $searchRequest); |
|
| 279 | - |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Method is called after results of a search are returned by the |
|
| 283 | - * Search Platform. |
|
| 284 | - * |
|
| 285 | - * Your Content Provider can detail each entry with local data to improve |
|
| 286 | - * the display of the search result. |
|
| 287 | - * |
|
| 288 | - * @see ISearchResult |
|
| 289 | - * |
|
| 290 | - * @since 15.0.0 |
|
| 291 | - * |
|
| 292 | - * @param ISearchResult $searchResult |
|
| 293 | - */ |
|
| 294 | - public function improveSearchResult(ISearchResult $searchResult); |
|
| 295 | - |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * not used yet. |
|
| 299 | - * |
|
| 300 | - * @since 15.0.0 |
|
| 301 | - */ |
|
| 302 | - public function unloadProvider(); |
|
| 83 | + /** |
|
| 84 | + * Must returns a unique Id used to identify the Content Provider. |
|
| 85 | + * Id must contains only alphanumeric chars, with no space. |
|
| 86 | + * |
|
| 87 | + * @since 15.0.0 |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function getId(): string; |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Must returns a descriptive name of the Content Provider. |
|
| 96 | + * This is used in multiple places, so better use a clear display name. |
|
| 97 | + * |
|
| 98 | + * @since 15.0.0 |
|
| 99 | + * |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | + public function getName(): string; |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Should returns the current configuration of the Content Provider. |
|
| 107 | + * This is used to display the configuration when using the |
|
| 108 | + * ./occ fulltextsearch:check command line. |
|
| 109 | + * |
|
| 110 | + * @since 15.0.0 |
|
| 111 | + * |
|
| 112 | + * @return array |
|
| 113 | + */ |
|
| 114 | + public function getConfiguration(): array; |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Must returns a SearchTemplate that contains displayable items and |
|
| 119 | + * available options to users when searching. |
|
| 120 | + * |
|
| 121 | + * @see SearchTemplate |
|
| 122 | + * |
|
| 123 | + * @since 15.0.0 |
|
| 124 | + * |
|
| 125 | + * @return SearchTemplate |
|
| 126 | + */ |
|
| 127 | + public function getSearchTemplate(): SearchTemplate; |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Called when FullTextSearch is loading your Content Provider. |
|
| 132 | + * |
|
| 133 | + * @since 15.0.0 |
|
| 134 | + */ |
|
| 135 | + public function loadProvider(); |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * Set the wrapper of the currently executed process. |
|
| 140 | + * Because the index process can be long and heavy, and because errors can |
|
| 141 | + * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 142 | + * Content Provider to communicate with the process initiated by |
|
| 143 | + * FullTextSearch. |
|
| 144 | + * |
|
| 145 | + * The IRunner is coming with some methods so the Content Provider can |
|
| 146 | + * returns important information and errors to be displayed to the admin. |
|
| 147 | + * |
|
| 148 | + * @since 15.0.0 |
|
| 149 | + * |
|
| 150 | + * @param IRunner $runner |
|
| 151 | + */ |
|
| 152 | + public function setRunner(IRunner $runner); |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * This method is called when the administrator specify options when running |
|
| 157 | + * the ./occ fulltextsearch:index or ./occ fulltextsearch:live |
|
| 158 | + * |
|
| 159 | + * @since 15.0.0 |
|
| 160 | + * |
|
| 161 | + * @param IIndexOptions $options |
|
| 162 | + */ |
|
| 163 | + public function setIndexOptions(IIndexOptions $options); |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Returns all indexable document for a user as an array of IndexDocument. |
|
| 168 | + * |
|
| 169 | + * There is no need to fill each IndexDocument with content; at this point, |
|
| 170 | + * only fill the object with the minimum information to not waste memory while |
|
| 171 | + * still being able to identify the document it is referring to. |
|
| 172 | + * |
|
| 173 | + * FullTextSearch will call 2 other methods of this interface for each |
|
| 174 | + * IndexDocument of the array, prior to their indexing: |
|
| 175 | + * |
|
| 176 | + * - first, to compare the date of the last index, |
|
| 177 | + * - then, to fill each IndexDocument with complete data |
|
| 178 | + * |
|
| 179 | + * @see IndexDocument |
|
| 180 | + * |
|
| 181 | + * @since 15.0.0 |
|
| 182 | + * |
|
| 183 | + * @param string $userId |
|
| 184 | + * |
|
| 185 | + * @return IndexDocument[] |
|
| 186 | + */ |
|
| 187 | + public function generateIndexableDocuments(string $userId): array; |
|
| 188 | + |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * Called to verify that the document is not already indexed and that the |
|
| 192 | + * old index is not up-to-date, using the IIndex from |
|
| 193 | + * IndexDocument->getIndex() |
|
| 194 | + * |
|
| 195 | + * Returning true will not queue the current IndexDocument to any further |
|
| 196 | + * operation and will continue on the next element from the list returned by |
|
| 197 | + * generateIndexableDocuments(). |
|
| 198 | + * |
|
| 199 | + * @since 15.0.0 |
|
| 200 | + * |
|
| 201 | + * @param IndexDocument $document |
|
| 202 | + * |
|
| 203 | + * @return bool |
|
| 204 | + */ |
|
| 205 | + public function isDocumentUpToDate(IndexDocument $document): bool; |
|
| 206 | + |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Must fill IndexDocument with all information relative to the document, |
|
| 210 | + * before its indexing by the Search Platform. |
|
| 211 | + * |
|
| 212 | + * Method is called for each element returned previously by |
|
| 213 | + * generateIndexableDocuments(). |
|
| 214 | + * |
|
| 215 | + * @see IndexDocument |
|
| 216 | + * |
|
| 217 | + * @since 15.0.0 |
|
| 218 | + * |
|
| 219 | + * @param IndexDocument $document |
|
| 220 | + */ |
|
| 221 | + public function fillIndexDocument(IndexDocument $document); |
|
| 222 | + |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * The Search Provider must create and return an IndexDocument |
|
| 226 | + * based on the IIndex and its status. The IndexDocument must contains all |
|
| 227 | + * information as it will be send for indexing. |
|
| 228 | + * |
|
| 229 | + * Method is called during a cron or a ./occ fulltextsearch:live after a |
|
| 230 | + * new document is created, or an old document is set as modified. |
|
| 231 | + * |
|
| 232 | + * @since 15.0.0 |
|
| 233 | + * |
|
| 234 | + * @param IIndex $index |
|
| 235 | + * |
|
| 236 | + * @return IndexDocument |
|
| 237 | + */ |
|
| 238 | + public function updateDocument(IIndex $index): IndexDocument; |
|
| 239 | + |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * Called when an index is initiated by the administrator. |
|
| 243 | + * This is should only be used in case of a specific mapping is needed. |
|
| 244 | + * (ie. _almost_ never) |
|
| 245 | + * |
|
| 246 | + * @since 15.0.0 |
|
| 247 | + * |
|
| 248 | + * @param IFullTextSearchPlatform $platform |
|
| 249 | + */ |
|
| 250 | + public function onInitializingIndex(IFullTextSearchPlatform $platform); |
|
| 251 | + |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Called when administrator is resetting the index. |
|
| 255 | + * This is should only be used in case of a specific mapping has been |
|
| 256 | + * created. |
|
| 257 | + * |
|
| 258 | + * @since 15.0.0 |
|
| 259 | + * |
|
| 260 | + * @param IFullTextSearchPlatform $platform |
|
| 261 | + */ |
|
| 262 | + public function onResettingIndex(IFullTextSearchPlatform $platform); |
|
| 263 | + |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * Method is called when a search request is initiated by a user, prior to |
|
| 267 | + * be sent to the Search Platform. |
|
| 268 | + * |
|
| 269 | + * Your Content Provider can interact with the ISearchRequest to apply the |
|
| 270 | + * search options and make the search more precise. |
|
| 271 | + * |
|
| 272 | + * @see ISearchRequest |
|
| 273 | + * |
|
| 274 | + * @since 15.0.0 |
|
| 275 | + * |
|
| 276 | + * @param ISearchRequest $searchRequest |
|
| 277 | + */ |
|
| 278 | + public function improveSearchRequest(ISearchRequest $searchRequest); |
|
| 279 | + |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Method is called after results of a search are returned by the |
|
| 283 | + * Search Platform. |
|
| 284 | + * |
|
| 285 | + * Your Content Provider can detail each entry with local data to improve |
|
| 286 | + * the display of the search result. |
|
| 287 | + * |
|
| 288 | + * @see ISearchResult |
|
| 289 | + * |
|
| 290 | + * @since 15.0.0 |
|
| 291 | + * |
|
| 292 | + * @param ISearchResult $searchResult |
|
| 293 | + */ |
|
| 294 | + public function improveSearchResult(ISearchResult $searchResult); |
|
| 295 | + |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * not used yet. |
|
| 299 | + * |
|
| 300 | + * @since 15.0.0 |
|
| 301 | + */ |
|
| 302 | + public function unloadProvider(); |
|
| 303 | 303 | |
| 304 | 304 | } |
@@ -45,45 +45,45 @@ |
||
| 45 | 45 | interface ISearchService { |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * generate a search request, based on an array: |
|
| 50 | - * |
|
| 51 | - * $request = |
|
| 52 | - * [ |
|
| 53 | - * 'providers' => (string/array) 'all' |
|
| 54 | - * 'author' => (string) owner of the document. |
|
| 55 | - * 'search' => (string) search string, |
|
| 56 | - * 'size' => (int) number of items to be return |
|
| 57 | - * 'page' => (int) page |
|
| 58 | - * 'parts' => (array) parts of document to search within, |
|
| 59 | - * 'options' = (array) search options, |
|
| 60 | - * 'tags' => (array) tags, |
|
| 61 | - * 'metatags' => (array) metatags, |
|
| 62 | - * 'subtags' => (array) subtags |
|
| 63 | - * ] |
|
| 64 | - * |
|
| 65 | - * 'providers' can be an array of providerIds |
|
| 66 | - * |
|
| 67 | - * @since 15.0.0 |
|
| 68 | - * |
|
| 69 | - * @param array $request |
|
| 70 | - * |
|
| 71 | - * @return ISearchRequest |
|
| 72 | - */ |
|
| 73 | - public function generateSearchRequest(array $request): ISearchRequest; |
|
| 48 | + /** |
|
| 49 | + * generate a search request, based on an array: |
|
| 50 | + * |
|
| 51 | + * $request = |
|
| 52 | + * [ |
|
| 53 | + * 'providers' => (string/array) 'all' |
|
| 54 | + * 'author' => (string) owner of the document. |
|
| 55 | + * 'search' => (string) search string, |
|
| 56 | + * 'size' => (int) number of items to be return |
|
| 57 | + * 'page' => (int) page |
|
| 58 | + * 'parts' => (array) parts of document to search within, |
|
| 59 | + * 'options' = (array) search options, |
|
| 60 | + * 'tags' => (array) tags, |
|
| 61 | + * 'metatags' => (array) metatags, |
|
| 62 | + * 'subtags' => (array) subtags |
|
| 63 | + * ] |
|
| 64 | + * |
|
| 65 | + * 'providers' can be an array of providerIds |
|
| 66 | + * |
|
| 67 | + * @since 15.0.0 |
|
| 68 | + * |
|
| 69 | + * @param array $request |
|
| 70 | + * |
|
| 71 | + * @return ISearchRequest |
|
| 72 | + */ |
|
| 73 | + public function generateSearchRequest(array $request): ISearchRequest; |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Search documents |
|
| 78 | - * |
|
| 79 | - * @since 15.0.0 |
|
| 80 | - * |
|
| 81 | - * @param string $userId |
|
| 82 | - * @param ISearchRequest $searchRequest |
|
| 83 | - * |
|
| 84 | - * @return ISearchResult[] |
|
| 85 | - */ |
|
| 86 | - public function search(string $userId, ISearchRequest $searchRequest): array; |
|
| 76 | + /** |
|
| 77 | + * Search documents |
|
| 78 | + * |
|
| 79 | + * @since 15.0.0 |
|
| 80 | + * |
|
| 81 | + * @param string $userId |
|
| 82 | + * @param ISearchRequest $searchRequest |
|
| 83 | + * |
|
| 84 | + * @return ISearchResult[] |
|
| 85 | + */ |
|
| 86 | + public function search(string $userId, ISearchRequest $searchRequest): array; |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
@@ -44,56 +44,56 @@ |
||
| 44 | 44 | interface IIndexService { |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Retrieve an Index from the database, based on the Id of the Provider |
|
| 49 | - * and the Id of the Document |
|
| 50 | - * |
|
| 51 | - * @since 15.0.0 |
|
| 52 | - * |
|
| 53 | - * @param string $providerId |
|
| 54 | - * @param string $documentId |
|
| 55 | - * |
|
| 56 | - * @return IIndex |
|
| 57 | - */ |
|
| 58 | - public function getIndex(string $providerId, string $documentId): IIndex; |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Update the status of an Index. status is a bit flag, setting $reset to |
|
| 63 | - * true will reset the status to the value defined in the parameter. |
|
| 64 | - * |
|
| 65 | - * @since 15.0.0 |
|
| 66 | - * |
|
| 67 | - * @param string $providerId |
|
| 68 | - * @param $documentId |
|
| 69 | - * @param int $status |
|
| 70 | - * @param bool $reset |
|
| 71 | - */ |
|
| 72 | - public function updateIndexStatus(string $providerId, $documentId, int $status, bool $reset = false); |
|
| 73 | - |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Update the status of an array of Index. status is a bit flag, setting $reset to |
|
| 77 | - * true will reset the status to the value defined in the parameter. |
|
| 78 | - * |
|
| 79 | - * @since 15.0.0 |
|
| 80 | - * |
|
| 81 | - * @param string $providerId |
|
| 82 | - * @param array $documentIds |
|
| 83 | - * @param int $status |
|
| 84 | - * @param bool $reset |
|
| 85 | - */ |
|
| 86 | - public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false); |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Update an array of Index. |
|
| 91 | - * |
|
| 92 | - * @since 15.0.0 |
|
| 93 | - * |
|
| 94 | - * @param array $indexes |
|
| 95 | - */ |
|
| 96 | - public function updateIndexes(array $indexes); |
|
| 47 | + /** |
|
| 48 | + * Retrieve an Index from the database, based on the Id of the Provider |
|
| 49 | + * and the Id of the Document |
|
| 50 | + * |
|
| 51 | + * @since 15.0.0 |
|
| 52 | + * |
|
| 53 | + * @param string $providerId |
|
| 54 | + * @param string $documentId |
|
| 55 | + * |
|
| 56 | + * @return IIndex |
|
| 57 | + */ |
|
| 58 | + public function getIndex(string $providerId, string $documentId): IIndex; |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Update the status of an Index. status is a bit flag, setting $reset to |
|
| 63 | + * true will reset the status to the value defined in the parameter. |
|
| 64 | + * |
|
| 65 | + * @since 15.0.0 |
|
| 66 | + * |
|
| 67 | + * @param string $providerId |
|
| 68 | + * @param $documentId |
|
| 69 | + * @param int $status |
|
| 70 | + * @param bool $reset |
|
| 71 | + */ |
|
| 72 | + public function updateIndexStatus(string $providerId, $documentId, int $status, bool $reset = false); |
|
| 73 | + |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Update the status of an array of Index. status is a bit flag, setting $reset to |
|
| 77 | + * true will reset the status to the value defined in the parameter. |
|
| 78 | + * |
|
| 79 | + * @since 15.0.0 |
|
| 80 | + * |
|
| 81 | + * @param string $providerId |
|
| 82 | + * @param array $documentIds |
|
| 83 | + * @param int $status |
|
| 84 | + * @param bool $reset |
|
| 85 | + */ |
|
| 86 | + public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false); |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Update an array of Index. |
|
| 91 | + * |
|
| 92 | + * @since 15.0.0 |
|
| 93 | + * |
|
| 94 | + * @param array $indexes |
|
| 95 | + */ |
|
| 96 | + public function updateIndexes(array $indexes); |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
@@ -41,24 +41,24 @@ |
||
| 41 | 41 | interface IProviderService { |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Check if the provider $providerId is already indexed. |
|
| 46 | - * |
|
| 47 | - * @since 15.0.0 |
|
| 48 | - * |
|
| 49 | - * @param string $providerId |
|
| 50 | - * |
|
| 51 | - * @return bool |
|
| 52 | - */ |
|
| 53 | - public function isProviderIndexed(string $providerId); |
|
| 44 | + /** |
|
| 45 | + * Check if the provider $providerId is already indexed. |
|
| 46 | + * |
|
| 47 | + * @since 15.0.0 |
|
| 48 | + * |
|
| 49 | + * @param string $providerId |
|
| 50 | + * |
|
| 51 | + * @return bool |
|
| 52 | + */ |
|
| 53 | + public function isProviderIndexed(string $providerId); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Add the Javascript API in the navigation page of an app. |
|
| 58 | - * |
|
| 59 | - * @since 15.0.0 |
|
| 60 | - */ |
|
| 61 | - public function addJavascriptAPI(); |
|
| 56 | + /** |
|
| 57 | + * Add the Javascript API in the navigation page of an app. |
|
| 58 | + * |
|
| 59 | + * @since 15.0.0 |
|
| 60 | + */ |
|
| 61 | + public function addJavascriptAPI(); |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | } |
@@ -80,147 +80,147 @@ |
||
| 80 | 80 | interface IFullTextSearchPlatform { |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Must returns a unique Id used to identify the Search Platform. |
|
| 85 | - * Id must contains only alphanumeric chars, with no space. |
|
| 86 | - * |
|
| 87 | - * @since 15.0.0 |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function getId(): string; |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Must returns a descriptive name of the Search Platform. |
|
| 96 | - * This is used mainly in the admin settings page to display the list of |
|
| 97 | - * available Search Platform |
|
| 98 | - * |
|
| 99 | - * @since 15.0.0 |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function getName(): string; |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * should returns the current configuration of the Search Platform. |
|
| 108 | - * This is used to display the configuration when using the |
|
| 109 | - * ./occ fulltextsearch:check command line. |
|
| 110 | - * |
|
| 111 | - * @since 15.0.0 |
|
| 112 | - * |
|
| 113 | - * @return array |
|
| 114 | - */ |
|
| 115 | - public function getConfiguration(): array; |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Set the wrapper of the currently executed process. |
|
| 120 | - * Because the index process can be long and heavy, and because errors can |
|
| 121 | - * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 122 | - * Search Platform to communicate with the process initiated by |
|
| 123 | - * FullTextSearch. |
|
| 124 | - * |
|
| 125 | - * The IRunner is coming with some methods so the Search Platform can |
|
| 126 | - * returns important information and errors to be displayed to the admin. |
|
| 127 | - * |
|
| 128 | - * @since 15.0.0 |
|
| 129 | - * |
|
| 130 | - * @param IRunner $runner |
|
| 131 | - */ |
|
| 132 | - public function setRunner(IRunner $runner); |
|
| 133 | - |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Called when FullTextSearch is loading your Search Platform. |
|
| 137 | - * |
|
| 138 | - * @since 15.0.0 |
|
| 139 | - */ |
|
| 140 | - public function loadPlatform(); |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Called to check that your Search Platform is correctly configured and that |
|
| 145 | - * This is also the right place to check that the Search Service is available. |
|
| 146 | - * |
|
| 147 | - * @since 15.0.0 |
|
| 148 | - * |
|
| 149 | - * @return bool |
|
| 150 | - */ |
|
| 151 | - public function testPlatform(): bool; |
|
| 152 | - |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Called before an index is initiated. |
|
| 156 | - * Best place to initiate some stuff on the Search Server (mapping, ...) |
|
| 157 | - * |
|
| 158 | - * @since 15.0.0 |
|
| 159 | - */ |
|
| 160 | - public function initializeIndex(); |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * Reset the indexes for a specific providerId. |
|
| 165 | - * $providerId can be 'all' if it is a global reset. |
|
| 166 | - * |
|
| 167 | - * @since 15.0.0 |
|
| 168 | - * |
|
| 169 | - * @param string $providerId |
|
| 170 | - */ |
|
| 171 | - public function resetIndex(string $providerId); |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Deleting some IIndex, sent in an array |
|
| 176 | - * |
|
| 177 | - * @see IIndex |
|
| 178 | - * |
|
| 179 | - * @since 15.0.0 |
|
| 180 | - * |
|
| 181 | - * @param IIndex[] $indexes |
|
| 182 | - */ |
|
| 183 | - public function deleteIndexes(array $indexes); |
|
| 184 | - |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Indexing a document. |
|
| 188 | - * |
|
| 189 | - * @see IndexDocument |
|
| 190 | - * |
|
| 191 | - * @since 15.0.0 |
|
| 192 | - * |
|
| 193 | - * @param IndexDocument $document |
|
| 194 | - * |
|
| 195 | - * @return IIndex |
|
| 196 | - */ |
|
| 197 | - public function indexDocument(IndexDocument $document): IIndex; |
|
| 198 | - |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Searching documents, ISearchResult should be updated with the result of |
|
| 202 | - * the search. |
|
| 203 | - * |
|
| 204 | - * @since 15.0.0 |
|
| 205 | - * |
|
| 206 | - * @param ISearchResult $result |
|
| 207 | - * @param DocumentAccess $access |
|
| 208 | - */ |
|
| 209 | - public function searchRequest(ISearchResult $result, DocumentAccess $access); |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Return a document based on its Id and the Provider. |
|
| 214 | - * This is used when an admin execute ./occ fulltextsearch:document:platform |
|
| 215 | - * |
|
| 216 | - * @since 15.0.0 |
|
| 217 | - * |
|
| 218 | - * @param string $providerId |
|
| 219 | - * @param string $documentId |
|
| 220 | - * |
|
| 221 | - * @return IndexDocument |
|
| 222 | - */ |
|
| 223 | - public function getDocument(string $providerId, string $documentId): IndexDocument; |
|
| 83 | + /** |
|
| 84 | + * Must returns a unique Id used to identify the Search Platform. |
|
| 85 | + * Id must contains only alphanumeric chars, with no space. |
|
| 86 | + * |
|
| 87 | + * @since 15.0.0 |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function getId(): string; |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Must returns a descriptive name of the Search Platform. |
|
| 96 | + * This is used mainly in the admin settings page to display the list of |
|
| 97 | + * available Search Platform |
|
| 98 | + * |
|
| 99 | + * @since 15.0.0 |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function getName(): string; |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * should returns the current configuration of the Search Platform. |
|
| 108 | + * This is used to display the configuration when using the |
|
| 109 | + * ./occ fulltextsearch:check command line. |
|
| 110 | + * |
|
| 111 | + * @since 15.0.0 |
|
| 112 | + * |
|
| 113 | + * @return array |
|
| 114 | + */ |
|
| 115 | + public function getConfiguration(): array; |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Set the wrapper of the currently executed process. |
|
| 120 | + * Because the index process can be long and heavy, and because errors can |
|
| 121 | + * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 122 | + * Search Platform to communicate with the process initiated by |
|
| 123 | + * FullTextSearch. |
|
| 124 | + * |
|
| 125 | + * The IRunner is coming with some methods so the Search Platform can |
|
| 126 | + * returns important information and errors to be displayed to the admin. |
|
| 127 | + * |
|
| 128 | + * @since 15.0.0 |
|
| 129 | + * |
|
| 130 | + * @param IRunner $runner |
|
| 131 | + */ |
|
| 132 | + public function setRunner(IRunner $runner); |
|
| 133 | + |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Called when FullTextSearch is loading your Search Platform. |
|
| 137 | + * |
|
| 138 | + * @since 15.0.0 |
|
| 139 | + */ |
|
| 140 | + public function loadPlatform(); |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Called to check that your Search Platform is correctly configured and that |
|
| 145 | + * This is also the right place to check that the Search Service is available. |
|
| 146 | + * |
|
| 147 | + * @since 15.0.0 |
|
| 148 | + * |
|
| 149 | + * @return bool |
|
| 150 | + */ |
|
| 151 | + public function testPlatform(): bool; |
|
| 152 | + |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Called before an index is initiated. |
|
| 156 | + * Best place to initiate some stuff on the Search Server (mapping, ...) |
|
| 157 | + * |
|
| 158 | + * @since 15.0.0 |
|
| 159 | + */ |
|
| 160 | + public function initializeIndex(); |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * Reset the indexes for a specific providerId. |
|
| 165 | + * $providerId can be 'all' if it is a global reset. |
|
| 166 | + * |
|
| 167 | + * @since 15.0.0 |
|
| 168 | + * |
|
| 169 | + * @param string $providerId |
|
| 170 | + */ |
|
| 171 | + public function resetIndex(string $providerId); |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Deleting some IIndex, sent in an array |
|
| 176 | + * |
|
| 177 | + * @see IIndex |
|
| 178 | + * |
|
| 179 | + * @since 15.0.0 |
|
| 180 | + * |
|
| 181 | + * @param IIndex[] $indexes |
|
| 182 | + */ |
|
| 183 | + public function deleteIndexes(array $indexes); |
|
| 184 | + |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Indexing a document. |
|
| 188 | + * |
|
| 189 | + * @see IndexDocument |
|
| 190 | + * |
|
| 191 | + * @since 15.0.0 |
|
| 192 | + * |
|
| 193 | + * @param IndexDocument $document |
|
| 194 | + * |
|
| 195 | + * @return IIndex |
|
| 196 | + */ |
|
| 197 | + public function indexDocument(IndexDocument $document): IIndex; |
|
| 198 | + |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Searching documents, ISearchResult should be updated with the result of |
|
| 202 | + * the search. |
|
| 203 | + * |
|
| 204 | + * @since 15.0.0 |
|
| 205 | + * |
|
| 206 | + * @param ISearchResult $result |
|
| 207 | + * @param DocumentAccess $access |
|
| 208 | + */ |
|
| 209 | + public function searchRequest(ISearchResult $result, DocumentAccess $access); |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Return a document based on its Id and the Provider. |
|
| 214 | + * This is used when an admin execute ./occ fulltextsearch:document:platform |
|
| 215 | + * |
|
| 216 | + * @since 15.0.0 |
|
| 217 | + * |
|
| 218 | + * @param string $providerId |
|
| 219 | + * @param string $documentId |
|
| 220 | + * |
|
| 221 | + * @return IndexDocument |
|
| 222 | + */ |
|
| 223 | + public function getDocument(string $providerId, string $documentId): IndexDocument; |
|
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | } |
@@ -51,135 +51,135 @@ |
||
| 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 | - /** |
|
| 83 | - * Add the Javascript API in the navigation page of an app. |
|
| 84 | - * Needed to replace the default search. |
|
| 85 | - * |
|
| 86 | - * @since 15.0.0 |
|
| 87 | - */ |
|
| 88 | - public function addJavascriptAPI(); |
|
| 89 | - |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Check if the provider $providerId is already indexed. |
|
| 93 | - * |
|
| 94 | - * @since 15.0.0 |
|
| 95 | - * |
|
| 96 | - * @param string $providerId |
|
| 97 | - * |
|
| 98 | - * @return bool |
|
| 99 | - */ |
|
| 100 | - public function isProviderIndexed(string $providerId): bool; |
|
| 101 | - |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Retrieve an Index from the database, based on the Id of the Provider |
|
| 105 | - * and the Id of the Document |
|
| 106 | - * |
|
| 107 | - * @since 15.0.0 |
|
| 108 | - * |
|
| 109 | - * @param string $providerId |
|
| 110 | - * @param string $documentId |
|
| 111 | - * |
|
| 112 | - * @return IIndex |
|
| 113 | - */ |
|
| 114 | - public function getIndex(string $providerId, string $documentId): IIndex; |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Create a new Index. |
|
| 119 | - * |
|
| 120 | - * This method must be called when a new document is created. |
|
| 121 | - * |
|
| 122 | - * @since 15.0.0 |
|
| 123 | - * |
|
| 124 | - * @param string $providerId |
|
| 125 | - * @param string $documentId |
|
| 126 | - * @param string $userId |
|
| 127 | - * @param int $status |
|
| 128 | - * |
|
| 129 | - * @return IIndex |
|
| 130 | - */ |
|
| 131 | - public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex; |
|
| 132 | - |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * Update the status of an Index. status is a bitflag, setting $reset to |
|
| 136 | - * true will reset the status to the value defined in the parameter. |
|
| 137 | - * |
|
| 138 | - * @since 15.0.0 |
|
| 139 | - * |
|
| 140 | - * @param string $providerId |
|
| 141 | - * @param string $documentId |
|
| 142 | - * @param int $status |
|
| 143 | - * @param bool $reset |
|
| 144 | - */ |
|
| 145 | - public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false); |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * Update the status of an array of Index. status is a bit flag, setting $reset to |
|
| 150 | - * true will reset the status to the value defined in the parameter. |
|
| 151 | - * |
|
| 152 | - * @since 15.0.0 |
|
| 153 | - * |
|
| 154 | - * @param string $providerId |
|
| 155 | - * @param array $documentIds |
|
| 156 | - * @param int $status |
|
| 157 | - * @param bool $reset |
|
| 158 | - */ |
|
| 159 | - public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false); |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Update an array of Index. |
|
| 163 | - * |
|
| 164 | - * @since 15.0.0 |
|
| 165 | - * |
|
| 166 | - * @param IIndex[] $indexes |
|
| 167 | - */ |
|
| 168 | - public function updateIndexes(array $indexes); |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Search using an array as request. If $userId is empty, will use the |
|
| 172 | - * current session. |
|
| 173 | - * |
|
| 174 | - * @see ISearchService::generateSearchRequest |
|
| 175 | - * |
|
| 176 | - * @since 15.0.0 |
|
| 177 | - * |
|
| 178 | - * @param array $request |
|
| 179 | - * @param string $userId |
|
| 180 | - * @return ISearchResult[] |
|
| 181 | - */ |
|
| 182 | - 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 | + /** |
|
| 83 | + * Add the Javascript API in the navigation page of an app. |
|
| 84 | + * Needed to replace the default search. |
|
| 85 | + * |
|
| 86 | + * @since 15.0.0 |
|
| 87 | + */ |
|
| 88 | + public function addJavascriptAPI(); |
|
| 89 | + |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Check if the provider $providerId is already indexed. |
|
| 93 | + * |
|
| 94 | + * @since 15.0.0 |
|
| 95 | + * |
|
| 96 | + * @param string $providerId |
|
| 97 | + * |
|
| 98 | + * @return bool |
|
| 99 | + */ |
|
| 100 | + public function isProviderIndexed(string $providerId): bool; |
|
| 101 | + |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Retrieve an Index from the database, based on the Id of the Provider |
|
| 105 | + * and the Id of the Document |
|
| 106 | + * |
|
| 107 | + * @since 15.0.0 |
|
| 108 | + * |
|
| 109 | + * @param string $providerId |
|
| 110 | + * @param string $documentId |
|
| 111 | + * |
|
| 112 | + * @return IIndex |
|
| 113 | + */ |
|
| 114 | + public function getIndex(string $providerId, string $documentId): IIndex; |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Create a new Index. |
|
| 119 | + * |
|
| 120 | + * This method must be called when a new document is created. |
|
| 121 | + * |
|
| 122 | + * @since 15.0.0 |
|
| 123 | + * |
|
| 124 | + * @param string $providerId |
|
| 125 | + * @param string $documentId |
|
| 126 | + * @param string $userId |
|
| 127 | + * @param int $status |
|
| 128 | + * |
|
| 129 | + * @return IIndex |
|
| 130 | + */ |
|
| 131 | + public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex; |
|
| 132 | + |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * Update the status of an Index. status is a bitflag, setting $reset to |
|
| 136 | + * true will reset the status to the value defined in the parameter. |
|
| 137 | + * |
|
| 138 | + * @since 15.0.0 |
|
| 139 | + * |
|
| 140 | + * @param string $providerId |
|
| 141 | + * @param string $documentId |
|
| 142 | + * @param int $status |
|
| 143 | + * @param bool $reset |
|
| 144 | + */ |
|
| 145 | + public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false); |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * Update the status of an array of Index. status is a bit flag, setting $reset to |
|
| 150 | + * true will reset the status to the value defined in the parameter. |
|
| 151 | + * |
|
| 152 | + * @since 15.0.0 |
|
| 153 | + * |
|
| 154 | + * @param string $providerId |
|
| 155 | + * @param array $documentIds |
|
| 156 | + * @param int $status |
|
| 157 | + * @param bool $reset |
|
| 158 | + */ |
|
| 159 | + public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false); |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Update an array of Index. |
|
| 163 | + * |
|
| 164 | + * @since 15.0.0 |
|
| 165 | + * |
|
| 166 | + * @param IIndex[] $indexes |
|
| 167 | + */ |
|
| 168 | + public function updateIndexes(array $indexes); |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Search using an array as request. If $userId is empty, will use the |
|
| 172 | + * current session. |
|
| 173 | + * |
|
| 174 | + * @see ISearchService::generateSearchRequest |
|
| 175 | + * |
|
| 176 | + * @since 15.0.0 |
|
| 177 | + * |
|
| 178 | + * @param array $request |
|
| 179 | + * @param string $userId |
|
| 180 | + * @return ISearchResult[] |
|
| 181 | + */ |
|
| 182 | + public function search(array $request, string $userId = ''): array; |
|
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | } |
@@ -46,41 +46,41 @@ |
||
| 46 | 46 | interface IIndexOptions { |
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Get the value (as a string) for an option. |
|
| 51 | - * |
|
| 52 | - * @since 15.0.0 |
|
| 53 | - * |
|
| 54 | - * @param string $option |
|
| 55 | - * @param string $default |
|
| 56 | - * |
|
| 57 | - * @return string |
|
| 58 | - */ |
|
| 59 | - public function getOption(string $option, string $default = ''): string; |
|
| 49 | + /** |
|
| 50 | + * Get the value (as a string) for an option. |
|
| 51 | + * |
|
| 52 | + * @since 15.0.0 |
|
| 53 | + * |
|
| 54 | + * @param string $option |
|
| 55 | + * @param string $default |
|
| 56 | + * |
|
| 57 | + * @return string |
|
| 58 | + */ |
|
| 59 | + public function getOption(string $option, string $default = ''): string; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Get the value (as an array) for an option. |
|
| 63 | - * |
|
| 64 | - * @since 15.0.0 |
|
| 65 | - * |
|
| 66 | - * @param string $option |
|
| 67 | - * @param array $default |
|
| 68 | - * |
|
| 69 | - * @return array |
|
| 70 | - */ |
|
| 71 | - public function getOptionArray(string $option, array $default = []): array; |
|
| 61 | + /** |
|
| 62 | + * Get the value (as an array) for an option. |
|
| 63 | + * |
|
| 64 | + * @since 15.0.0 |
|
| 65 | + * |
|
| 66 | + * @param string $option |
|
| 67 | + * @param array $default |
|
| 68 | + * |
|
| 69 | + * @return array |
|
| 70 | + */ |
|
| 71 | + public function getOptionArray(string $option, array $default = []): array; |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Get the value (as an boolean) for an option. |
|
| 75 | - * |
|
| 76 | - * @since 15.0.0 |
|
| 77 | - * |
|
| 78 | - * @param string $option |
|
| 79 | - * @param bool $default |
|
| 80 | - * |
|
| 81 | - * @return bool |
|
| 82 | - */ |
|
| 83 | - public function getOptionBool(string $option, bool $default): bool; |
|
| 73 | + /** |
|
| 74 | + * Get the value (as an boolean) for an option. |
|
| 75 | + * |
|
| 76 | + * @since 15.0.0 |
|
| 77 | + * |
|
| 78 | + * @param string $option |
|
| 79 | + * @param bool $default |
|
| 80 | + * |
|
| 81 | + * @return bool |
|
| 82 | + */ |
|
| 83 | + public function getOptionBool(string $option, bool $default): bool; |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
@@ -56,143 +56,143 @@ |
||
| 56 | 56 | interface ISearchResult { |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Get the original SearchRequest. |
|
| 61 | - * |
|
| 62 | - * @see ISearchRequest |
|
| 63 | - * |
|
| 64 | - * @since 15.0.0 |
|
| 65 | - * |
|
| 66 | - * @return ISearchRequest |
|
| 67 | - */ |
|
| 68 | - public function getRequest(): ISearchRequest; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Get the targeted Content Provider. |
|
| 72 | - * |
|
| 73 | - * @since 15.0.0 |
|
| 74 | - * |
|
| 75 | - * @return IFullTextSearchProvider |
|
| 76 | - */ |
|
| 77 | - public function getProvider(): IFullTextSearchProvider; |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Add an IndexDocument as one of the result of the search request. |
|
| 82 | - * |
|
| 83 | - * @since 15.0.0 |
|
| 84 | - * |
|
| 85 | - * @param IndexDocument $document |
|
| 86 | - * |
|
| 87 | - * @return ISearchResult |
|
| 88 | - */ |
|
| 89 | - public function addDocument(IndexDocument $document): ISearchResult; |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Returns all result of the search request, in an array of IndexDocument. |
|
| 93 | - * |
|
| 94 | - * @since 15.0.0 |
|
| 95 | - * |
|
| 96 | - * @return array |
|
| 97 | - */ |
|
| 98 | - public function getDocuments(): array; |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Set an array of IndexDocument as the result of the search request. |
|
| 102 | - * |
|
| 103 | - * @since 15.0.0 |
|
| 104 | - * |
|
| 105 | - * @param IndexDocument[] $documents |
|
| 106 | - * |
|
| 107 | - * @return ISearchResult |
|
| 108 | - */ |
|
| 109 | - public function setDocuments(array $documents): ISearchResult; |
|
| 110 | - |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Add an aggregation to the result. |
|
| 114 | - * |
|
| 115 | - * @since 15.0.0 |
|
| 116 | - * |
|
| 117 | - * @param string $category |
|
| 118 | - * @param string $value |
|
| 119 | - * @param int $count |
|
| 120 | - * |
|
| 121 | - * @return ISearchResult |
|
| 122 | - */ |
|
| 123 | - public function addAggregation(string $category, string $value, int $count): ISearchResult; |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * Get all aggregations. |
|
| 127 | - * |
|
| 128 | - * @since 15.0.0 |
|
| 129 | - * |
|
| 130 | - * @param string $category |
|
| 131 | - * |
|
| 132 | - * @return array |
|
| 133 | - */ |
|
| 134 | - public function getAggregations(string $category): array; |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * Set the raw result of the request. |
|
| 139 | - * |
|
| 140 | - * @since 15.0.0 |
|
| 141 | - * |
|
| 142 | - * @param string $result |
|
| 143 | - * |
|
| 144 | - * @return ISearchResult |
|
| 145 | - */ |
|
| 146 | - public function setRawResult(string $result): ISearchResult; |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Set the total number of results for the search request. |
|
| 151 | - * Used by pagination. |
|
| 152 | - * |
|
| 153 | - * @since 15.0.0 |
|
| 154 | - * |
|
| 155 | - * @param int $total |
|
| 156 | - * |
|
| 157 | - * @return ISearchResult |
|
| 158 | - */ |
|
| 159 | - public function setTotal(int $total): ISearchResult; |
|
| 160 | - |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Set the top score for the search request. |
|
| 164 | - * |
|
| 165 | - * @since 15.0.0 |
|
| 166 | - * |
|
| 167 | - * @param int $score |
|
| 168 | - * |
|
| 169 | - * @return ISearchResult |
|
| 170 | - */ |
|
| 171 | - public function setMaxScore(int $score): ISearchResult; |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Set the time spent by the request to perform the search. |
|
| 176 | - * |
|
| 177 | - * @since 15.0.0 |
|
| 178 | - * |
|
| 179 | - * @param int $time |
|
| 180 | - * |
|
| 181 | - * @return ISearchResult |
|
| 182 | - */ |
|
| 183 | - public function setTime(int $time): ISearchResult; |
|
| 184 | - |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Set to true if the request timed out. |
|
| 188 | - * |
|
| 189 | - * @since 15.0.0 |
|
| 190 | - * |
|
| 191 | - * @param bool $timedOut |
|
| 192 | - * |
|
| 193 | - * @return ISearchResult |
|
| 194 | - */ |
|
| 195 | - public function setTimedOut(bool $timedOut): ISearchResult; |
|
| 59 | + /** |
|
| 60 | + * Get the original SearchRequest. |
|
| 61 | + * |
|
| 62 | + * @see ISearchRequest |
|
| 63 | + * |
|
| 64 | + * @since 15.0.0 |
|
| 65 | + * |
|
| 66 | + * @return ISearchRequest |
|
| 67 | + */ |
|
| 68 | + public function getRequest(): ISearchRequest; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Get the targeted Content Provider. |
|
| 72 | + * |
|
| 73 | + * @since 15.0.0 |
|
| 74 | + * |
|
| 75 | + * @return IFullTextSearchProvider |
|
| 76 | + */ |
|
| 77 | + public function getProvider(): IFullTextSearchProvider; |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Add an IndexDocument as one of the result of the search request. |
|
| 82 | + * |
|
| 83 | + * @since 15.0.0 |
|
| 84 | + * |
|
| 85 | + * @param IndexDocument $document |
|
| 86 | + * |
|
| 87 | + * @return ISearchResult |
|
| 88 | + */ |
|
| 89 | + public function addDocument(IndexDocument $document): ISearchResult; |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Returns all result of the search request, in an array of IndexDocument. |
|
| 93 | + * |
|
| 94 | + * @since 15.0.0 |
|
| 95 | + * |
|
| 96 | + * @return array |
|
| 97 | + */ |
|
| 98 | + public function getDocuments(): array; |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Set an array of IndexDocument as the result of the search request. |
|
| 102 | + * |
|
| 103 | + * @since 15.0.0 |
|
| 104 | + * |
|
| 105 | + * @param IndexDocument[] $documents |
|
| 106 | + * |
|
| 107 | + * @return ISearchResult |
|
| 108 | + */ |
|
| 109 | + public function setDocuments(array $documents): ISearchResult; |
|
| 110 | + |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Add an aggregation to the result. |
|
| 114 | + * |
|
| 115 | + * @since 15.0.0 |
|
| 116 | + * |
|
| 117 | + * @param string $category |
|
| 118 | + * @param string $value |
|
| 119 | + * @param int $count |
|
| 120 | + * |
|
| 121 | + * @return ISearchResult |
|
| 122 | + */ |
|
| 123 | + public function addAggregation(string $category, string $value, int $count): ISearchResult; |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * Get all aggregations. |
|
| 127 | + * |
|
| 128 | + * @since 15.0.0 |
|
| 129 | + * |
|
| 130 | + * @param string $category |
|
| 131 | + * |
|
| 132 | + * @return array |
|
| 133 | + */ |
|
| 134 | + public function getAggregations(string $category): array; |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * Set the raw result of the request. |
|
| 139 | + * |
|
| 140 | + * @since 15.0.0 |
|
| 141 | + * |
|
| 142 | + * @param string $result |
|
| 143 | + * |
|
| 144 | + * @return ISearchResult |
|
| 145 | + */ |
|
| 146 | + public function setRawResult(string $result): ISearchResult; |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Set the total number of results for the search request. |
|
| 151 | + * Used by pagination. |
|
| 152 | + * |
|
| 153 | + * @since 15.0.0 |
|
| 154 | + * |
|
| 155 | + * @param int $total |
|
| 156 | + * |
|
| 157 | + * @return ISearchResult |
|
| 158 | + */ |
|
| 159 | + public function setTotal(int $total): ISearchResult; |
|
| 160 | + |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Set the top score for the search request. |
|
| 164 | + * |
|
| 165 | + * @since 15.0.0 |
|
| 166 | + * |
|
| 167 | + * @param int $score |
|
| 168 | + * |
|
| 169 | + * @return ISearchResult |
|
| 170 | + */ |
|
| 171 | + public function setMaxScore(int $score): ISearchResult; |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Set the time spent by the request to perform the search. |
|
| 176 | + * |
|
| 177 | + * @since 15.0.0 |
|
| 178 | + * |
|
| 179 | + * @param int $time |
|
| 180 | + * |
|
| 181 | + * @return ISearchResult |
|
| 182 | + */ |
|
| 183 | + public function setTime(int $time): ISearchResult; |
|
| 184 | + |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Set to true if the request timed out. |
|
| 188 | + * |
|
| 189 | + * @since 15.0.0 |
|
| 190 | + * |
|
| 191 | + * @param bool $timedOut |
|
| 192 | + * |
|
| 193 | + * @return ISearchResult |
|
| 194 | + */ |
|
| 195 | + public function setTimedOut(bool $timedOut): ISearchResult; |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -48,94 +48,94 @@ |
||
| 48 | 48 | interface IRunner { |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - const RESULT_TYPE_SUCCESS = 1; |
|
| 52 | - const RESULT_TYPE_WARNING = 4; |
|
| 53 | - const RESULT_TYPE_FAIL = 9; |
|
| 54 | - |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Info are displayed in the user interface when an admin execute the |
|
| 58 | - * ./occ fulltextsearch:index command. |
|
| 59 | - * |
|
| 60 | - * quick list of info that can be edited: |
|
| 61 | - * 'documentId', 'info', 'title', 'resultIndex', 'resultStatus', |
|
| 62 | - * 'content', 'documentCurrent', 'documentTotal', 'progressStatus', |
|
| 63 | - * 'errorCurrent', 'errorException', 'errorIndex'. |
|
| 64 | - * |
|
| 65 | - * List of all editable info can be find in the Command\Index.php of the |
|
| 66 | - * FullTextSearch app. |
|
| 67 | - * (look for a comment 'full list of info that can be edited') |
|
| 68 | - * |
|
| 69 | - * @since 15.0.0 |
|
| 70 | - * |
|
| 71 | - * @param string $info |
|
| 72 | - * @param string $value |
|
| 73 | - */ |
|
| 74 | - public function setInfo(string $info, string $value); |
|
| 75 | - |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * This method should be used when editing multiple info to avoid too many |
|
| 79 | - * refresh of the interface. |
|
| 80 | - * |
|
| 81 | - * @since 15.0.0 |
|
| 82 | - * |
|
| 83 | - * @param array $data |
|
| 84 | - */ |
|
| 85 | - public function setInfoArray(array $data); |
|
| 86 | - |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Method used to update the current Action when an index is running. |
|
| 90 | - * |
|
| 91 | - * This method should be used instead of manually update the 'action' using |
|
| 92 | - * setInfo()/setInfoArray() as it is also used to keep the process alive, |
|
| 93 | - * manage the input, and some statistics of the load of the process. |
|
| 94 | - * |
|
| 95 | - * $action is a string with no space |
|
| 96 | - * $force should be set to true if the action is heavy while being executed |
|
| 97 | - * multiple times |
|
| 98 | - * |
|
| 99 | - * @since 15.0.0 |
|
| 100 | - * |
|
| 101 | - * @param string $action |
|
| 102 | - * @param bool $force |
|
| 103 | - * |
|
| 104 | - * @return string |
|
| 105 | - * @throws \Exception |
|
| 106 | - */ |
|
| 107 | - public function updateAction(string $action = '', bool $force = false): string; |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Call this method in a Search Platform or Content Provider if there is an |
|
| 112 | - * issue while generating a document or while indexing the current document. |
|
| 113 | - * This is used to store and display errors in the UI during an index to help |
|
| 114 | - * admin to keep track of errors. |
|
| 115 | - * |
|
| 116 | - * @since 15.0.0 |
|
| 117 | - * |
|
| 118 | - * @param IIndex $index |
|
| 119 | - * @param string $message |
|
| 120 | - * @param string $class |
|
| 121 | - * @param int $sev |
|
| 122 | - */ |
|
| 123 | - public function newIndexError(IIndex $index, string $message, string $class = '', int $sev = 3); |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Call this method only in a Search Platform after an index of a document. |
|
| 128 | - * This is used to store and display results (good or bad) in the UI during |
|
| 129 | - * an index to help admin to keep track of fail and successful indexes. |
|
| 130 | - * |
|
| 131 | - * @since 15.0.0 |
|
| 132 | - * |
|
| 133 | - * @param IIndex $index |
|
| 134 | - * @param string $message |
|
| 135 | - * @param string $status |
|
| 136 | - * @param int $type |
|
| 137 | - */ |
|
| 138 | - public function newIndexResult(IIndex $index, string $message, string $status, int $type); |
|
| 51 | + const RESULT_TYPE_SUCCESS = 1; |
|
| 52 | + const RESULT_TYPE_WARNING = 4; |
|
| 53 | + const RESULT_TYPE_FAIL = 9; |
|
| 54 | + |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Info are displayed in the user interface when an admin execute the |
|
| 58 | + * ./occ fulltextsearch:index command. |
|
| 59 | + * |
|
| 60 | + * quick list of info that can be edited: |
|
| 61 | + * 'documentId', 'info', 'title', 'resultIndex', 'resultStatus', |
|
| 62 | + * 'content', 'documentCurrent', 'documentTotal', 'progressStatus', |
|
| 63 | + * 'errorCurrent', 'errorException', 'errorIndex'. |
|
| 64 | + * |
|
| 65 | + * List of all editable info can be find in the Command\Index.php of the |
|
| 66 | + * FullTextSearch app. |
|
| 67 | + * (look for a comment 'full list of info that can be edited') |
|
| 68 | + * |
|
| 69 | + * @since 15.0.0 |
|
| 70 | + * |
|
| 71 | + * @param string $info |
|
| 72 | + * @param string $value |
|
| 73 | + */ |
|
| 74 | + public function setInfo(string $info, string $value); |
|
| 75 | + |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * This method should be used when editing multiple info to avoid too many |
|
| 79 | + * refresh of the interface. |
|
| 80 | + * |
|
| 81 | + * @since 15.0.0 |
|
| 82 | + * |
|
| 83 | + * @param array $data |
|
| 84 | + */ |
|
| 85 | + public function setInfoArray(array $data); |
|
| 86 | + |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Method used to update the current Action when an index is running. |
|
| 90 | + * |
|
| 91 | + * This method should be used instead of manually update the 'action' using |
|
| 92 | + * setInfo()/setInfoArray() as it is also used to keep the process alive, |
|
| 93 | + * manage the input, and some statistics of the load of the process. |
|
| 94 | + * |
|
| 95 | + * $action is a string with no space |
|
| 96 | + * $force should be set to true if the action is heavy while being executed |
|
| 97 | + * multiple times |
|
| 98 | + * |
|
| 99 | + * @since 15.0.0 |
|
| 100 | + * |
|
| 101 | + * @param string $action |
|
| 102 | + * @param bool $force |
|
| 103 | + * |
|
| 104 | + * @return string |
|
| 105 | + * @throws \Exception |
|
| 106 | + */ |
|
| 107 | + public function updateAction(string $action = '', bool $force = false): string; |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Call this method in a Search Platform or Content Provider if there is an |
|
| 112 | + * issue while generating a document or while indexing the current document. |
|
| 113 | + * This is used to store and display errors in the UI during an index to help |
|
| 114 | + * admin to keep track of errors. |
|
| 115 | + * |
|
| 116 | + * @since 15.0.0 |
|
| 117 | + * |
|
| 118 | + * @param IIndex $index |
|
| 119 | + * @param string $message |
|
| 120 | + * @param string $class |
|
| 121 | + * @param int $sev |
|
| 122 | + */ |
|
| 123 | + public function newIndexError(IIndex $index, string $message, string $class = '', int $sev = 3); |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Call this method only in a Search Platform after an index of a document. |
|
| 128 | + * This is used to store and display results (good or bad) in the UI during |
|
| 129 | + * an index to help admin to keep track of fail and successful indexes. |
|
| 130 | + * |
|
| 131 | + * @since 15.0.0 |
|
| 132 | + * |
|
| 133 | + * @param IIndex $index |
|
| 134 | + * @param string $message |
|
| 135 | + * @param string $status |
|
| 136 | + * @param int $type |
|
| 137 | + */ |
|
| 138 | + public function newIndexResult(IIndex $index, string $message, string $status, int $type); |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | } |