mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-19 16:11:41 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
d628b01ede
|
@ -77,10 +77,10 @@ class SeedDMS_Lucene_Search {
|
||||||
$querystr = substr($term, -1) != '*' ? $term.'*' : $term;
|
$querystr = substr($term, -1) != '*' ? $term.'*' : $term;
|
||||||
}
|
}
|
||||||
if(!empty($fields['owner'])) {
|
if(!empty($fields['owner'])) {
|
||||||
if(is_string($owner)) {
|
if(is_string($fields['owner'])) {
|
||||||
if($querystr)
|
if($querystr)
|
||||||
$querystr .= ' && ';
|
$querystr .= ' && ';
|
||||||
$querystr .= 'owner:'.$owner;
|
$querystr .= 'owner:'.$fields['owner'];
|
||||||
} elseif(is_array($fields['owner'])) {
|
} elseif(is_array($fields['owner'])) {
|
||||||
if($querystr)
|
if($querystr)
|
||||||
$querystr .= ' && ';
|
$querystr .= ' && ';
|
||||||
|
|
|
@ -111,7 +111,7 @@ class SeedDMS_SQLiteFTS_Document {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFieldValue($fieldName) {
|
public function getFieldValue($fieldName) {
|
||||||
return $this->getField($fieldName)->value;
|
return $this->getField($fieldName)->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -219,7 +219,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* First count some records for facets */
|
/* 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`";
|
$sql = "SELECT `".$facetname."`, count(*) AS `c` FROM `docs`";
|
||||||
if($query) {
|
if($query) {
|
||||||
$sql .= " WHERE docs MATCH ".$this->_conn->quote($query);
|
$sql .= " WHERE docs MATCH ".$this->_conn->quote($query);
|
||||||
|
@ -252,6 +252,8 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
else
|
else
|
||||||
$facets[$facetname][$row[$facetname]] += $row['c'];
|
$facets[$facetname][$row[$facetname]] += $row['c'];
|
||||||
}
|
}
|
||||||
|
} elseif($facetname == 'status') {
|
||||||
|
$facets[$facetname][($row[$facetname]-10).''] = $row['c'];
|
||||||
} else
|
} else
|
||||||
$facets[$facetname][$row[$facetname]] = $row['c'];
|
$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::Keyword('indexed', $rec['indexed']));
|
||||||
$doc->addField(SeedDMS_SQLiteFTS_Field::Text('users', $rec['users']));
|
$doc->addField(SeedDMS_SQLiteFTS_Field::Text('users', $rec['users']));
|
||||||
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('status', $rec['status']));
|
$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)
|
if($content)
|
||||||
$doc->addField(SeedDMS_SQLiteFTS_Field::UnStored('content', $rec['content']));
|
$doc->addField(SeedDMS_SQLiteFTS_Field::UnStored('content', $rec['content']));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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'])) {
|
if(!isset($facets['category'])) {
|
||||||
$tmpcatids = array();
|
$tmpcatids = array();
|
||||||
foreach($categories as $tmpcat)
|
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) {
|
if($facets) {
|
||||||
foreach($facets as $facetname=>$values) {
|
foreach($facets as $facetname=>$values) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user