ISearchService.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\FullTextSearch\Service;
  8. use OCP\FullTextSearch\Model\ISearchRequest;
  9. use OCP\FullTextSearch\Model\ISearchResult;
  10. /**
  11. * Interface ISearchService
  12. *
  13. * @since 15.0.0
  14. *
  15. */
  16. interface ISearchService {
  17. /**
  18. * generate a search request, based on an array:
  19. *
  20. * $request =
  21. * [
  22. * 'providers' => (string/array) 'all'
  23. * 'author' => (string) owner of the document.
  24. * 'search' => (string) search string,
  25. * 'size' => (int) number of items to be return
  26. * 'page' => (int) page
  27. * 'parts' => (array) parts of document to search within,
  28. * 'options' = (array) search options,
  29. * 'tags' => (array) tags,
  30. * 'metatags' => (array) metatags,
  31. * 'subtags' => (array) subtags
  32. * ]
  33. *
  34. * 'providers' can be an array of providerIds
  35. *
  36. * @since 15.0.0
  37. *
  38. * @param array $request
  39. *
  40. * @return ISearchRequest
  41. */
  42. public function generateSearchRequest(array $request): ISearchRequest;
  43. /**
  44. * Search documents
  45. *
  46. * @since 15.0.0
  47. *
  48. * @param string $userId
  49. * @param ISearchRequest $searchRequest
  50. *
  51. * @return ISearchResult[]
  52. */
  53. public function search(string $userId, ISearchRequest $searchRequest): array;
  54. }