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-04-09 13:02:54 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-04-09 13:02:54 +0300
commit733b219bce6a8fd3a188184c07744d820adde23e (patch)
treef2201753a42a8e02f0a1072679f4886a350df1ad /lib
parentf19364776c5827ca7fd18c500355d5d520f9d1a1 (diff)
save used options during index
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Db/IndexesRequest.php2
-rw-r--r--lib/Db/IndexesRequestBuilder.php8
-rw-r--r--lib/Model/Index.php22
3 files changed, 29 insertions, 3 deletions
diff --git a/lib/Db/IndexesRequest.php b/lib/Db/IndexesRequest.php
index 35e03f7..0e6a97f 100644
--- a/lib/Db/IndexesRequest.php
+++ b/lib/Db/IndexesRequest.php
@@ -51,6 +51,7 @@ class IndexesRequest extends IndexesRequestBuilder {
->setValue('err', $qb->createNamedParameter($index->getError()))
->setValue('message', $qb->createNamedParameter($index->getMessage()))
->setValue('status', $qb->createNamedParameter($index->getStatus()))
+ ->setValue('options', $qb->createNamedParameter(json_encode($index->getOptions())))
->setValue('indexed', $qb->createNamedParameter($index->getLastIndex()));
$qb->execute();
@@ -77,6 +78,7 @@ class IndexesRequest extends IndexesRequestBuilder {
$qb = $this->getIndexesUpdateSql();
$qb->set('status', $qb->createNamedParameter($index->getStatus()));
+ $qb->set('options', $qb->createNamedParameter(json_encode($index->getOptions())));
if ($index->getOwnerId() !== '') {
$qb->set('owner_id', $qb->createNamedParameter($index->getOwnerId()));
diff --git a/lib/Db/IndexesRequestBuilder.php b/lib/Db/IndexesRequestBuilder.php
index d058322..4557886 100644
--- a/lib/Db/IndexesRequestBuilder.php
+++ b/lib/Db/IndexesRequestBuilder.php
@@ -43,7 +43,8 @@ class IndexesRequestBuilder extends CoreRequestBuilder {
* {@inheritdoc}
*/
public function __construct(
- IL10N $l10n, IDBConnection $connection, ConfigService $configService, MiscService $miscService
+ IL10N $l10n, IDBConnection $connection, ConfigService $configService,
+ MiscService $miscService
) {
parent::__construct($l10n, $connection, $configService, $miscService);
}
@@ -85,8 +86,8 @@ class IndexesRequestBuilder extends CoreRequestBuilder {
/** @noinspection PhpMethodParametersCountMismatchInspection */
$qb->select(
- 'li.owner_id', 'li.provider_id', 'li.document_id', 'li.status', 'li.err', 'li.message',
- 'li.indexed'
+ 'li.owner_id', 'li.provider_id', 'li.document_id', 'li.status', 'li.options', 'li.err',
+ 'li.message', 'li.indexed'
)
->from(self::TABLE_INDEXES, 'li');
@@ -117,6 +118,7 @@ class IndexesRequestBuilder extends CoreRequestBuilder {
protected function parseIndexesSelectSql($data) {
$index = new ExtendedIndex($data['provider_id'], $data['document_id']);
$index->setStatus($data['status'])
+ ->setOptions(json_decode($data['options'], true))
->setError($data['err'])
->setMessage($data['message'])
->setOwnerId($data['owner_id'])
diff --git a/lib/Model/Index.php b/lib/Model/Index.php
index cb8478d..739d4a1 100644
--- a/lib/Model/Index.php
+++ b/lib/Model/Index.php
@@ -56,6 +56,9 @@ class Index implements \JsonSerializable {
/** @var int */
private $status = 0;
+ /** @var array */
+ private $options = [];
+
/** @var int */
private $err = 0;
@@ -151,6 +154,25 @@ class Index implements \JsonSerializable {
/**
+ * @param array $options
+ *
+ * @return $this
+ */
+ public function setOptions($options) {
+ $this->options = $options;
+
+ return $this;
+ }
+
+ /**
+ * @return array
+ */
+ public function getOptions() {
+ return $this->options;
+ }
+
+
+ /**
* @param int $err
*
* @return $this