Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-01-11 13:28:55 +01:00
commit d628b01ede
4 changed files with 23 additions and 21 deletions

View File

@ -77,10 +77,10 @@ class SeedDMS_Lucene_Search {
$querystr = substr($term, -1) != '*' ? $term.'*' : $term;
}
if(!empty($fields['owner'])) {
if(is_string($owner)) {
if(is_string($fields['owner'])) {
if($querystr)
$querystr .= ' && ';
$querystr .= 'owner:'.$owner;
$querystr .= 'owner:'.$fields['owner'];
} elseif(is_array($fields['owner'])) {
if($querystr)
$querystr .= ' && ';

View File

@ -111,7 +111,7 @@ class SeedDMS_SQLiteFTS_Document {
* @return string
*/
public function getFieldValue($fieldName) {
return $this->getField($fieldName)->value;
return $this->getField($fieldName)->value;
}
}
?>

View File

@ -219,7 +219,7 @@ class SeedDMS_SQLiteFTS_Indexer {
return false;
/* First count some records for facets */
foreach(array('owner', 'mimetype', 'category') as $facetname) {
foreach(array('owner', 'mimetype', 'category', 'status') as $facetname) {
$sql = "SELECT `".$facetname."`, count(*) AS `c` FROM `docs`";
if($query) {
$sql .= " WHERE docs MATCH ".$this->_conn->quote($query);
@ -252,6 +252,8 @@ class SeedDMS_SQLiteFTS_Indexer {
else
$facets[$facetname][$row[$facetname]] += $row['c'];
}
} elseif($facetname == 'status') {
$facets[$facetname][($row[$facetname]-10).''] = $row['c'];
} else
$facets[$facetname][$row[$facetname]] = $row['c'];
}
@ -379,7 +381,7 @@ class SeedDMS_SQLiteFTS_Indexer {
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('indexed', $rec['indexed']));
$doc->addField(SeedDMS_SQLiteFTS_Field::Text('users', $rec['users']));
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('status', $rec['status']));
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('path', $rec['path']));
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('path', explode('x', substr($rec['path'], 1, -1))));
if($content)
$doc->addField(SeedDMS_SQLiteFTS_Field::UnStored('content', $rec['content']));
}

View File

@ -805,6 +805,22 @@ function typeahead() { /* {{{ */
)
);
}
if(!isset($facets['record_type'])) {
$options = array();
$options[] = array('document', getMLText('document'), $record_type && in_array('document', $record_type));
$options[] = array('folder', getMLText('folder'), $record_type && in_array('folder', $record_type));
$this->formField(
getMLText("record_type"),
array(
'element'=>'select',
'class'=>'chzn-select',
'name'=>'record_type[]',
'multiple'=>true,
'attributes'=>array(array('data-placeholder', getMLText('select_record_type'))),
'options'=>$options
)
);
}
if(!isset($facets['category'])) {
$tmpcatids = array();
foreach($categories as $tmpcat)
@ -852,22 +868,6 @@ function typeahead() { /* {{{ */
)
);
}
if(!isset($facets['record_type'])) {
$options = array();
$options[] = array('document', getMLText('document'), $record_type && in_array('document', $record_type));
$options[] = array('folder', getMLText('folder'), $record_type && in_array('folder', $record_type));
$this->formField(
getMLText("record_type"),
array(
'element'=>'select',
'class'=>'chzn-select',
'name'=>'record_type[]',
'multiple'=>true,
'attributes'=>array(array('data-placeholder', getMLText('select_record_type'))),
'options'=>$options
)
);
}
if($facets) {
foreach($facets as $facetname=>$values) {