SearchComposer¶
-
class
OC\Search\
SearchComposer
¶ - Queries individual \OCP\Search\IProvider implementations and composes aunified search result for the user’s search termThe search process is generally split into two steps1. Get a list of provider (`getProviders`)2. Get search results of each provider (`search`)The reasoning behind this is that the runtime complexity of a combined searchresult would be O(n) and linearly grow with each provider added. This comesfrom the nature of php where we can’t concurrently fetch the search results.So we offload the concurrency the client application (e.g. JavaScript in thebrowser) and let it first get the list of providers to then fetch all resultsconcurrently. The client is free to decide whether all concurrent searchresults are awaited or shown as they come in.
Source: lib/private/Search/SearchComposer.php#61
Properties¶
Methods¶
-
public
OC\Search\SearchComposer::
__construct
($bootstrapCoordinator, $container, $logger)¶ Source: lib/private/Search/SearchComposer.php#75
-
public
OC\Search\SearchComposer::
getProviders
($route, $routeParameters)¶ - Get a list of all provider IDs & Names for the consecutive calls to `search`Sort the list by the order property
Source: Parameters: - $route (string) the route the user is currently at
- $routeParameters (array) the parameters of the route the user is currently at
Returns: array
-
public
OC\Search\SearchComposer::
search
($user, $providerId, $query)¶ - Query an individual search provider for results
Source: Parameters: - $user (
OCP\IUser
) - $providerId (string) one of the IDs received by getProviders
- $query (
OCP\Search\ISearchQuery
)
Returns: Throws: \InvalidArgumentException
when the $providerId does not correspond to a registered provider - $user (