mirror of
https://codeberg.org/SeedDMS/paperless
synced 2025-02-11 09:25:23 +00:00
autocomplete just completes the last term of a list of space separated terms
This commit is contained in:
parent
5b37300aa8
commit
d114d74dba
|
@ -547,6 +547,13 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
|
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* autocompletion is done on the last term of a list of comma separated
|
||||||
|
* terms. The returned value is then a list of the first n-1 terms
|
||||||
|
* concatenated with the completed terms, e.g.
|
||||||
|
* 'term1 ter' will be auto completed to 'term1 term2', 'term1 term3',
|
||||||
|
* etc.
|
||||||
|
*/
|
||||||
function autocomplete($request, $response) { /* {{{ */
|
function autocomplete($request, $response) { /* {{{ */
|
||||||
$dms = $this->container->dms;
|
$dms = $this->container->dms;
|
||||||
$userobj = $this->container->userobj;
|
$userobj = $this->container->userobj;
|
||||||
|
@ -559,7 +566,8 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
else
|
else
|
||||||
$field = 'title';
|
$field = 'title';
|
||||||
$params = $request->getQueryParams();
|
$params = $request->getQueryParams();
|
||||||
$query = $params['term'];
|
$allterms = explode(' ', $params['term']);
|
||||||
|
$query = trim(array_pop($allterms));
|
||||||
$logger->log(var_export($params, true), PEAR_LOG_DEBUG);
|
$logger->log(var_export($params, true), PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
|
@ -567,7 +575,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
if($index) {
|
if($index) {
|
||||||
if($terms = $index->terms($query, $field)) {
|
if($terms = $index->terms($query, $field)) {
|
||||||
foreach($terms as $term)
|
foreach($terms as $term)
|
||||||
$list[] = $term->text;
|
$list[] = implode(' ', $allterms).' '.$term->text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user