diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-04-09 13:02:54 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-04-09 13:02:54 +0300 |
commit | 733b219bce6a8fd3a188184c07744d820adde23e (patch) | |
tree | f2201753a42a8e02f0a1072679f4886a350df1ad | |
parent | f19364776c5827ca7fd18c500355d5d520f9d1a1 (diff) |
save used options during index
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | appinfo/database.xml | 7 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | lib/Db/IndexesRequest.php | 2 | ||||
-rw-r--r-- | lib/Db/IndexesRequestBuilder.php | 8 | ||||
-rw-r--r-- | lib/Model/Index.php | 22 |
5 files changed, 37 insertions, 4 deletions
diff --git a/appinfo/database.xml b/appinfo/database.xml index 49a14a2..f636c6c 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -65,6 +65,13 @@ </field> <field> + <name>options</name> + <type>text</type> + <length>511</length> + <notnull>false</notnull> + </field> + + <field> <name>err</name> <type>integer</type> <length>1</length> diff --git a/appinfo/info.xml b/appinfo/info.xml index dd30bdd..b0d9407 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -10,7 +10,7 @@ Core App of the full-text search framework for your Nextcloud. ]]> </description> - <version>0.6.1</version> + <version>0.6.2</version> <licence>agpl</licence> <author>Maxence Lange</author> <namespace>FullTextSearch</namespace> 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 |