1
0

search.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @copyright 2012 Frank Karlitschek frank@owncloud.org
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * provides an interface to all search providers
  24. *
  25. * @deprecated use \OCP\ISearch / \OC\Search instead
  26. */
  27. class OC_Search {
  28. /**
  29. * @return \OCP\ISearch
  30. */
  31. private static function getSearch() {
  32. return \OC::$server->getSearch();
  33. }
  34. /**
  35. * Search all providers for $query
  36. * @param string $query
  37. * @return array An array of OCP\Search\Result's
  38. */
  39. public static function search($query) {
  40. return self::getSearch()->search($query);
  41. }
  42. /**
  43. * Register a new search provider to search with
  44. * @param string $class class name of a OCP\Search\Provider
  45. * @param array $options optional
  46. */
  47. public static function registerProvider($class, $options = array()) {
  48. return self::getSearch()->registerProvider($class, $options);
  49. }
  50. /**
  51. * Remove one existing search provider
  52. * @param string $provider class name of a OCP\Search\Provider
  53. */
  54. public static function removeProvider($provider) {
  55. return self::getSearch()->removeProvider($provider);
  56. }
  57. /**
  58. * Remove all registered search providers
  59. */
  60. public static function clearProviders() {
  61. return self::getSearch()->clearProviders();
  62. }
  63. }