diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-05-31 02:53:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-31 02:53:57 +0300 |
commit | 8383bae3bc2c0adaa4172d99899be9c52c1410ea (patch) | |
tree | 096d58771a686ab4f17435d5e355829496f77f1c | |
parent | b1f27998ea0a69ee0c11bba5faeeb9fcb56ec0bb (diff) | |
parent | 4481246d8d97e6d767d5c6876789eca88228aac8 (diff) |
Merge pull request #508 from nextcloud/test-request
options test_request
-rw-r--r-- | lib/Service/IndexService.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Service/IndexService.php b/lib/Service/IndexService.php index 6c3a3be..3193a21 100644 --- a/lib/Service/IndexService.php +++ b/lib/Service/IndexService.php @@ -218,7 +218,9 @@ class IndexService implements IIndexService { private function updateDocumentsWithCurrIndex( IFullTextSearchProvider $provider, array $documents, IIndexOptions $options ): array { - $currIndex = $this->getProviderIndexFromProvider($provider->getId()); + if (!$options->getOptionBool('test_request', false)) { + $currIndex = $this->getProviderIndexFromProvider($provider->getId()); + } $result = []; $count = 0; foreach ($documents as $document) { @@ -230,7 +232,13 @@ class IndexService implements IIndexService { $count++; try { - $index = $currIndex->getIndex($document->getId()); + if ($options->getOptionBool('test_request', false)) { + $index = $this->indexesRequest->getIndex( + $document->getProviderId(), $document->getId() + ); + } else { + $index = $currIndex->getIndex($document->getId()); + } } catch (IndexDoesNotExistException $e) { $index = new Index($document->getProviderId(), $document->getId()); $index->setStatus(Index::INDEX_FULL); |