mirror of
https://codeberg.org/SeedDMS/paperless
synced 2025-02-06 06:55:28 +00:00
field for autocompletion can be set
This commit is contained in:
parent
9f0df3cabe
commit
321f80f974
|
@ -554,6 +554,10 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
$fulltextservice = $this->container->fulltextservice;
|
$fulltextservice = $this->container->fulltextservice;
|
||||||
$logger = $this->container->logger;
|
$logger = $this->container->logger;
|
||||||
|
|
||||||
|
if(!empty($settings->_extensions['paperless']['autocompletefield']))
|
||||||
|
$field = $settings->_extensions['paperless']['autocompletefield'];
|
||||||
|
else
|
||||||
|
$field = 'title';
|
||||||
$params = $request->getQueryParams();
|
$params = $request->getQueryParams();
|
||||||
$query = $params['term'];
|
$query = $params['term'];
|
||||||
$logger->log(var_export($params, true), PEAR_LOG_DEBUG);
|
$logger->log(var_export($params, true), PEAR_LOG_DEBUG);
|
||||||
|
@ -561,7 +565,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
$list = [];
|
$list = [];
|
||||||
$index = $fulltextservice->Indexer();
|
$index = $fulltextservice->Indexer();
|
||||||
if($index) {
|
if($index) {
|
||||||
if($terms = $index->terms($query, 'title')) {
|
if($terms = $index->terms($query, $field)) {
|
||||||
foreach($terms as $term)
|
foreach($terms as $term)
|
||||||
$list[] = $term->text;
|
$list[] = $term->text;
|
||||||
}
|
}
|
||||||
|
|
8
conf.php
8
conf.php
|
@ -42,6 +42,14 @@ $EXT_CONF['paperless'] = array(
|
||||||
'internal'=>'categories',
|
'internal'=>'categories',
|
||||||
'allow_empty'=>true,
|
'allow_empty'=>true,
|
||||||
),
|
),
|
||||||
|
'autocompletefield' => array(
|
||||||
|
'title'=>'Field used for autocompletion',
|
||||||
|
'help'=>'The terms in this field will be used when the autocomplete method is called.',
|
||||||
|
'type'=>'select',
|
||||||
|
'multiple'=>false,
|
||||||
|
'options'=>['title'=>'Title', 'content'=>'Content'],
|
||||||
|
'allow_empty'=>true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'constraints' => array(
|
'constraints' => array(
|
||||||
'depends' => array('php' => '7.4.0-', 'seeddms' => array('5.1.29-5.1.99', '6.0.22-6.0.99')),
|
'depends' => array('php' => '7.4.0-', 'seeddms' => array('5.1.29-5.1.99', '6.0.22-6.0.99')),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user