From bc37e36c91c10f50587419d3a966abc3e7921177 Mon Sep 17 00:00:00 2001 From: steinm Date: Thu, 21 Jul 2011 06:52:46 +0000 Subject: [PATCH] - path to lucene class is now in _luceneClassDir - do not list documents which has been deleted --- op/op.SearchFulltext.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/op/op.SearchFulltext.php b/op/op.SearchFulltext.php index 838066618..f376949c0 100644 --- a/op/op.SearchFulltext.php +++ b/op/op.SearchFulltext.php @@ -117,12 +117,12 @@ if (isset($_GET["pg"])) { $startTime = getTime(); if($settings->_enableFullSearch) { - if(!empty($settings->_luceneDir)) - require_once($settings->_luceneDir.'/Lucene.php'); + if(!empty($settings->_luceneClassDir)) + require_once($settings->_luceneClassDir.'/Lucene.php'); else require_once('LetoDMS/Lucene.php'); } -$index = Zend_Search_Lucene::open($settings->_indexPath); +$index = Zend_Search_Lucene::open($settings->_luceneDir); $lucenesearch = new LetoDMS_Lucene_Search($index); $hits = $lucenesearch->search($query, $owner ? $owner->getLogin() : '', '', $categories); $limit = 25; @@ -139,9 +139,12 @@ if($pageNumber != 'all' && count($hits) > $limit) { $resArr['docs'] = array(); $resArr['totalDocs'] = 0; if($hits) { - $resArr['totalDocs'] = count($hits); + $resArr['totalDocs'] = 0; //count($hits); foreach($hits as $hit) { - $resArr['docs'][] = $dms->getDocument($hit['document_id']); + if($tmp = $dms->getDocument($hit['document_id'])) { + $resArr['docs'][] = $tmp; + $resArr['totalDocs']++; + } } } $searchTime = getTime() - $startTime;