search_api_multi.service.inc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /**
  3. * Interface defining the additional methods a service has to implement in order
  4. * to support the "search_api_multi" feature.
  5. *
  6. * The interface shouldn't be implemented directly (i.e., with a proper
  7. * "implements" statement) since this would introduce a needless dependency.
  8. */
  9. interface SearchApiMultiServiceInterface extends SearchApiServiceInterface {
  10. //
  11. // Additional methods
  12. //
  13. /**
  14. * Create a query object for searching on this server.
  15. *
  16. * @param $options
  17. * Associative array of options configuring this query. See
  18. * SearchApiMultiQueryInterface::__construct().
  19. *
  20. * @throws SearchApiException
  21. * If the server is currently disabled.
  22. *
  23. * @return SearchApiMultiQueryInterface
  24. * An object for searching this server.
  25. */
  26. public function queryMultiple(array $options = array());
  27. /**
  28. * Executes a search on the server represented by this object.
  29. *
  30. * @param SearchApiMultiQueryInterface $query
  31. * The search query to execute.
  32. *
  33. * @throws SearchApiException
  34. * If an error prevented the search from completing.
  35. *
  36. * @return array
  37. * An associative array containing the search results, as required by
  38. * SearchApiMultiQueryInterface::execute().
  39. */
  40. public function searchMultiple(SearchApiMultiQueryInterface $query);
  41. //
  42. // Changed documentation / post-conditions
  43. //
  44. /**
  45. * Determines whether this service class implementation supports a given
  46. * feature. Features are optional extensions to Search API functionality and
  47. * usually defined and used by third-party modules.
  48. * Currently, the only feature specified directly in the search_api project is
  49. * "search_api_facets", defined by the module of the same name.
  50. *
  51. * @param string $feature
  52. * The name of the optional feature.
  53. *
  54. * @return boolean
  55. * TRUE if this service knows and supports the specified feature. FALSE
  56. * otherwise.
  57. * Must return TRUE if $feature is "search_api_multi".
  58. */
  59. public function supportsFeature($feature);
  60. /**
  61. * Add a new index to this server.
  62. *
  63. * If the index was already added to the server, the object should treat this
  64. * as if removeIndex() and then addIndex() were called.
  65. *
  66. * The implementation of this method should call views_invalidate_cache(), if
  67. * the search_api_views and search_api_multi modules are enabled.
  68. *
  69. * @param SearchApiIndex $index
  70. * The index to add.
  71. */
  72. public function addIndex(SearchApiIndex $index);
  73. /**
  74. * Notify the server that the indexed field settings for the index have
  75. * changed.
  76. * If any user action is necessary as a result of this, the method should
  77. * use drupal_set_message() to notify the user.
  78. *
  79. * The implementation of this method should call views_invalidate_cache(), if
  80. * the search_api_views and search_api_multi modules are enabled.
  81. *
  82. * @param SearchApiIndex $index
  83. * The updated index.
  84. *
  85. * @return
  86. * TRUE, if this change affected the server in any way that forces it to
  87. * re-index the content. FALSE otherwise.
  88. */
  89. public function fieldsUpdated(SearchApiIndex $index);
  90. /**
  91. * Remove an index from this server.
  92. *
  93. * This might mean that the index has been deleted, or reassigned to a
  94. * different server. If you need to distinguish between these cases, inspect
  95. * $index->server.
  96. *
  97. * If the index wasn't added to the server, the method call should be ignored.
  98. *
  99. * The implementation of this method should call views_invalidate_cache(), if
  100. * the search_api_views and search_api_multi modules are enabled.
  101. *
  102. * @param $index
  103. * Either an object representing the index to remove, or its machine name
  104. * (if the index was completely deleted).
  105. */
  106. public function removeIndex($index);
  107. }