_rootFolderID; } else { $folderid = $_GET["folderid"]; } $folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("search_results"),getMLText("invalid_folder_id")); } // Create the keyword search string. This search spans up to three columns // in the database: keywords, name and comment. if (isset($_GET["query"]) && is_string($_GET["query"])) { $query = $_GET["query"]; } else { $query = ""; } // category $categories = array(); if(isset($_GET['categoryids']) && $_GET['categoryids']) { foreach($_GET['categoryids'] as $catid) { if($catid > 0) { $category = $dms->getDocumentCategory($catid); $categories[] = $category->getName(); } } } // // Get the page number to display. If the result set contains more than // 25 entries, it is displayed across multiple pages. // // This requires that a page number variable be used to track which page the // user is interested in, and an extra clause on the select statement. // // Default page to display is always one. $pageNumber=1; if (isset($_GET["pg"])) { if (is_numeric($_GET["pg"]) && $_GET["pg"]>0) { $pageNumber = (integer)$_GET["pg"]; } else if (!strcasecmp($_GET["pg"], "all")) { $pageNumber = "all"; } } // --------------- Suche starten -------------------------------------------- // Check to see if the search has been restricted to a particular // document owner. $owner = null; if (isset($_GET["ownerid"]) && is_numeric($_GET["ownerid"]) && $_GET["ownerid"]!=-1) { $owner = $dms->getUser($_GET["ownerid"]); if (!is_object($owner)) { UI::exitError(getMLText("search_results"),getMLText("unknown_owner")); } } $pageNumber=1; if (isset($_GET["pg"])) { if (is_numeric($_GET["pg"]) && $_GET["pg"]>0) { $pageNumber = (integer)$_GET["pg"]; } else if (!strcasecmp($_GET["pg"], "all")) { $pageNumber = "all"; } } $startTime = getTime(); if($settings->_enableFullSearch) { if(!empty($settings->_luceneClassDir)) require_once($settings->_luceneClassDir.'/Lucene.php'); else require_once('SeedDMS/Lucene.php'); } Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8'); $index = Zend_Search_Lucene::open($settings->_luceneDir); $lucenesearch = new SeedDMS_Lucene_Search($index); $hits = $lucenesearch->search($query, $owner ? $owner->getLogin() : '', '', $categories); $totalDocs = count($hits); $limit = 20; $resArr = array(); if($pageNumber != 'all' && count($hits) > $limit) { $resArr['totalPages'] = (int) (count($hits) / $limit); if ((count($hits)%$limit) > 0) $resArr['totalPages']++; $hits = array_slice($hits, ($pageNumber-1)*$limit, $limit); } else { $resArr['totalPages'] = 1; } $resArr['docs'] = array(); if($hits) { foreach($hits as $hit) { if($tmp = $dms->getDocument($hit['document_id'])) { $resArr['docs'][] = $tmp; } } } $searchTime = getTime() - $startTime; $searchTime = round($searchTime, 2); // -------------- Output results -------------------------------------------- $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'searchhits'=>$resArr['docs'], 'totalpages'=>$resArr['totalPages'], 'totaldocs'=>$totalDocs, 'pagenumber'=>$pageNumber, 'searchtime'=>$searchTime, 'urlparams'=>$_GET)); if($view) { $view->show(); exit; } UI::htmlStartPage(getMLText("search_results")); UI::globalNavigation($folder); UI::pageNavigation(getFolderPathHTML($folder, true), "", $folder); UI::contentHeading(getMLText("search_results")); UI::contentContainerStart(); ?>
$totalDocs)); } ?> | $searchTime));?> |