Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-09-04 16:25:50 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-09-04 16:25:50 +0300
commit2fe9dd2eaa223de5824273d5b351668577fef19e (patch)
treec674419d11022e3ea83a1a64aaf7099d6e71b001 /lib
parent1ae93001b8745a3031c691391ad00e098d002356 (diff)
searchRequest() to replace searchDocuments temporary
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Command/Test.php8
-rw-r--r--lib/IFullTextSearchPlatform.php10
-rw-r--r--lib/Service/SearchService.php16
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;
}