need to get fulltext index first before searching

This commit is contained in:
Uwe Steinmann 2024-07-16 09:37:14 +02:00
parent 4aee2e9e3b
commit 38326621a1

View File

@ -659,7 +659,8 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
/* more_like_id is set to find similar documents {{{ */
if(isset($params['more_like_id'])) {
if($fulltextservice && $lucenesearch = $fulltextservice->Search()) {
if($fulltextservice && $index = $fulltextservice->Indexer()) {
$lucenesearch = $fulltextservice->Search();
if($searchhit = $lucenesearch->getDocument((int) $params['more_like_id'])) {
$idoc = $searchhit->getDocument();
if($idoc) {
@ -800,7 +801,8 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
$aend = (int) makeTsFromDate($params['created__date__lt']);
}
if($fulltextservice && $lucenesearch = $fulltextservice->Search()) {
if($fulltextservice && $index = $fulltextservice->Indexer()) {
$lucenesearch = $fulltextservice->Search();
$logger->log('Query is '.$query, PEAR_LOG_DEBUG);
/*
$logger->log('User is '.$userobj->getLogin(), PEAR_LOG_DEBUG);
@ -991,7 +993,8 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
'documents_inbox'=>0,
);
if($fulltextservice && ($lucenesearch = $fulltextservice->Search())) {
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
$lucenesearch = $fulltextservice->Search();
$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) {
return $response->withStatus(500);