throw exeption in find()

This commit is contained in:
Uwe Steinmann 2022-03-04 08:15:52 +01:00
parent 8e542b448f
commit fe43b944c9

View File

@ -190,7 +190,8 @@ class SeedDMS_SQLiteFTS_Indexer {
$sql .= " WHERE docs MATCH ".$this->_conn->quote($query); $sql .= " WHERE docs MATCH ".$this->_conn->quote($query);
$res = $this->_conn->query($sql." GROUP BY `".$facetname."`"); $res = $this->_conn->query($sql." GROUP BY `".$facetname."`");
if(!$res) if(!$res)
return false; throw new SeedDMS_SQLiteFTS_Exception("Counting records in facet \"$facetname\" failed.");
// return false;
$facets[$facetname] = array(); $facets[$facetname] = array();
foreach($res as $row) { foreach($res as $row) {
if($row[$facetname] && $row['c']) { if($row[$facetname] && $row['c']) {
@ -220,7 +221,8 @@ class SeedDMS_SQLiteFTS_Indexer {
$sql .= " WHERE docs MATCH ".$this->_conn->quote($query); $sql .= " WHERE docs MATCH ".$this->_conn->quote($query);
$res = $this->_conn->query($sql." GROUP BY `record_type`"); $res = $this->_conn->query($sql." GROUP BY `record_type`");
if(!$res) if(!$res)
return false; throw new SeedDMS_SQLiteFTS_Exception("Counting records in facet \"record_type\" failed.");
// return false;
$facets['record_type'] = array('document'=>0, 'folder'=>0); $facets['record_type'] = array('document'=>0, 'folder'=>0);
foreach($res as $row) { foreach($res as $row) {
$facets['record_type'][$row['record_type']] = $row['c']; $facets['record_type'][$row['record_type']] = $row['c'];
@ -239,6 +241,8 @@ class SeedDMS_SQLiteFTS_Indexer {
if(!empty($limit['offset'])) if(!empty($limit['offset']))
$sql .= " OFFSET ".(int) $limit['offset']; $sql .= " OFFSET ".(int) $limit['offset'];
$res = $this->_conn->query($sql); $res = $this->_conn->query($sql);
if(!$res)
throw new SeedDMS_SQLiteFTS_Exception("Searching for documents failed.");
$hits = array(); $hits = array();
if($res) { if($res) {
foreach($res as $rec) { foreach($res as $rec) {