do not create facets when searching, because it takes very long and they are not needed

This commit is contained in:
Uwe Steinmann 2023-10-11 16:34:17 +02:00
parent 9dfd05247f
commit 5e0b31bf95

View File

@ -767,7 +767,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
$logger->log('offset is '.$offset, PEAR_LOG_DEBUG); $logger->log('offset is '.$offset, PEAR_LOG_DEBUG);
*/ */
$lucenesearch = $fulltextservice->Search(); $lucenesearch = $fulltextservice->Search();
$searchresult = $lucenesearch->search($query, array('record_type'=>['document'], 'status'=>[2], 'user'=>[$userobj->getLogin()], 'category'=>$categorynames, 'created_start'=>$astart, 'created_end'=>$aend, 'modified_start'=>$mstart, 'modified_end'=>$mend, 'startFolder'=>$startfolder, 'rootFolder'=>$rootfolder, 'attributes'=>$cattrs), array('limit'=>$limit, 'offset'=>$offset), $order); $searchresult = $lucenesearch->search($query, array('record_type'=>['document'], 'status'=>[2], 'user'=>[$userobj->getLogin()], 'category'=>$categorynames, 'created_start'=>$astart, 'created_end'=>$aend, 'modified_start'=>$mstart, 'modified_end'=>$mend, 'startFolder'=>$startfolder, 'rootFolder'=>$rootfolder, 'attributes'=>$cattrs), array('limit'=>$limit, 'offset'=>$offset), $order, array('no_facets'=>true));
if($searchresult) { if($searchresult) {
$recs = array(); $recs = array();
$facets = $searchresult['facets']; $facets = $searchresult['facets'];
@ -919,10 +919,15 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
} elseif(!isset($settings->_extensions['paperless']['rootfolder']) || !($startfolder = $dms->getFolder($settings->_extensions['paperless']['rootfolder']))) } elseif(!isset($settings->_extensions['paperless']['rootfolder']) || !($startfolder = $dms->getFolder($settings->_extensions['paperless']['rootfolder'])))
$startfolder = $dms->getFolder($settings->_rootFolderID); $startfolder = $dms->getFolder($settings->_rootFolderID);
$data = array(
'documents_total'=>0,
'documents_inbox'=>0,
);
$index = $fulltextservice->Indexer(); $index = $fulltextservice->Indexer();
if($index) { if($index) {
$lucenesearch = $fulltextservice->Search(); $lucenesearch = $fulltextservice->Search();
$searchresult = $lucenesearch->search('', array('record_type'=>['document'], 'status'=>[2], 'user'=>[$userobj->getLogin()], 'startFolder'=>$startfolder, 'rootFolder'=>$startfolder), array('limit'=>20), array()); $searchresult = $lucenesearch->search('', array('record_type'=>['document'], 'status'=>[2], 'user'=>[$userobj->getLogin()], 'startFolder'=>$startfolder, 'rootFolder'=>$startfolder), array('limit'=>1), array(), array('no_facets'=>true));
if($searchresult === false) { if($searchresult === false) {
return $response->withStatus(500); return $response->withStatus(500);
} else { } else {