diff options
-rw-r--r-- | lib/Command/Test.php | 8 | ||||
-rw-r--r-- | lib/IFullTextSearchPlatform.php | 10 | ||||
-rw-r--r-- | lib/Service/SearchService.php | 16 |
3 files changed, 26 insertions, 8 deletions
diff --git a/lib/Command/Test.php b/lib/Command/Test.php index ec65d06..c227b99 100644 --- a/lib/Command/Test.php +++ b/lib/Command/Test.php @@ -554,7 +554,13 @@ class Test extends ExtendedBase { $request = new SearchRequest(); $request->setSearch($search); - $searchResult = $testPlatform->searchDocuments($testProvider, $access, $request); + + $searchResult = new SearchResult($request); + $searchResult->setProvider($testProvider); + $searchResult->setPlatform($testPlatform); + + $testPlatform->searchRequest($searchResult, $access); + $this->output( $output, '(result: ' . $searchResult->getCount() . ', expected: ' . json_encode($expected) . ')', diff --git a/lib/IFullTextSearchPlatform.php b/lib/IFullTextSearchPlatform.php index 5147be9..4bf6256 100644 --- a/lib/IFullTextSearchPlatform.php +++ b/lib/IFullTextSearchPlatform.php @@ -138,6 +138,16 @@ interface IFullTextSearchPlatform { // /** +// * @param SearchRequest $request +// * @param DocumentAccess $access +// * @param SearchResult $result +// * +// * @return SearchResult +// */ +// public function searchRequest(SearchResult $result, DocumentAccess $access); + + +// /** // * @param string $providerId // * @param string $documentId // * diff --git a/lib/Service/SearchService.php b/lib/Service/SearchService.php index 663b7a7..3912139 100644 --- a/lib/Service/SearchService.php +++ b/lib/Service/SearchService.php @@ -102,7 +102,6 @@ class SearchService { * @param string $userId * @param SearchRequest $request * - * @return SearchResult[] * @throws EmptySearchException * @throws Exception * @throws ProviderDoesNotExistException @@ -129,11 +128,11 @@ class SearchService { $access = $this->getDocumentAccessFromUser($user); $result = $this->searchFromProviders($platform, $providers, $access, $request); - foreach ($result as $searchResult) { - $searchResult->setPlatform($platform); - $searchResult->setRequest($request); - } - +// foreach ($result as $searchResult) { +// $searchResult->setPlatform($platform); +// $searchResult->setRequest($request); +// } +// return $result; } @@ -165,11 +164,14 @@ class SearchService { $result = []; foreach ($providers AS $provider) { $provider->improveSearchRequest($request); - $searchResult = $platform->searchDocuments($provider, $access, $request); + + $searchResult = new SearchResult($request); $searchResult->setProvider($provider); $searchResult->setPlatform($platform); + $platform->searchRequest($searchResult, $access); $provider->improveSearchResult($searchResult); + $result[] = $searchResult; } |