search.php 1.9 KB

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