Merge branch 'seeddms-4.3.x' into seeddms-5.0.x

This commit is contained in:
Uwe Steinmann 2015-08-13 08:18:45 +02:00
commit 8d74f745f0
6 changed files with 25 additions and 16 deletions

View File

@ -57,7 +57,10 @@ class SeedDMS_SQLiteFTS_Indexer {
static function create($indexerDir) { /* {{{ */ static function create($indexerDir) { /* {{{ */
unlink($indexerDir.'/index.db'); unlink($indexerDir.'/index.db');
$index = new SeedDMS_SQLiteFTS_Indexer($indexerDir); $index = new SeedDMS_SQLiteFTS_Indexer($indexerDir);
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, owner, content, created, notindexed=created, matchinfo=fts3)'; /* Make sure the sequence of fields is identical to the field list
* in SeedDMS_SQLiteFTS_Term
*/
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, mimetype, origfilename, owner, content, created, notindexed=created, matchinfo=fts3)';
$res = $index->_conn->exec($sql); $res = $index->_conn->exec($sql);
if($res === false) { if($res === false) {
return null; return null;
@ -88,7 +91,7 @@ class SeedDMS_SQLiteFTS_Indexer {
if(!$this->_conn) if(!$this->_conn)
return false; return false;
$sql = "INSERT INTO docs (docid, title, comment, keywords, category, owner, content, created) VALUES(".$doc->getFieldValue('document_id').", ".$this->_conn->quote($doc->getFieldValue('title')).", ".$this->_conn->quote($doc->getFieldValue('comment')).", ".$this->_conn->quote($doc->getFieldValue('keywords')).", ".$this->_conn->quote($doc->getFieldValue('category')).", ".$this->_conn->quote($doc->getFieldValue('owner')).", ".$this->_conn->quote($doc->getFieldValue('content')).", ".time().")"; $sql = "INSERT INTO docs (docid, title, comment, keywords, category, owner, content, mimetype, origfilename, created) VALUES(".$doc->getFieldValue('document_id').", ".$this->_conn->quote($doc->getFieldValue('title')).", ".$this->_conn->quote($doc->getFieldValue('comment')).", ".$this->_conn->quote($doc->getFieldValue('keywords')).", ".$this->_conn->quote($doc->getFieldValue('category')).", ".$this->_conn->quote($doc->getFieldValue('owner')).", ".$this->_conn->quote($doc->getFieldValue('content')).", ".$this->_conn->quote($doc->getFieldValue('mimetype')).", ".$this->_conn->quote($doc->getFieldValue('origfilename')).", ".time().")";
$res = $this->_conn->exec($sql); $res = $this->_conn->exec($sql);
if($res === false) { if($res === false) {
var_dump($this->_conn->errorInfo()); var_dump($this->_conn->errorInfo());
@ -180,7 +183,7 @@ class SeedDMS_SQLiteFTS_Indexer {
if(!$this->_conn) if(!$this->_conn)
return false; return false;
$sql = "SELECT title, comment, owner, keywords, category, created FROM docs WHERE docid=".(int) $id; $sql = "SELECT title, comment, owner, keywords, category, mimetype, origfilename, created FROM docs WHERE docid=".(int) $id;
$res = $this->_conn->query($sql); $res = $this->_conn->query($sql);
$doc = false; $doc = false;
if($res) { if($res) {
@ -190,6 +193,8 @@ class SeedDMS_SQLiteFTS_Indexer {
$doc->addField('comment', $rec['comment']); $doc->addField('comment', $rec['comment']);
$doc->addField('keywords', $rec['keywords']); $doc->addField('keywords', $rec['keywords']);
$doc->addField('category', $rec['category']); $doc->addField('category', $rec['category']);
$doc->addField('mimetype', $rec['mimetype']);
$doc->addField('origfilename', $rec['origfilename']);
$doc->addField('owner', $rec['owner']); $doc->addField('owner', $rec['owner']);
$doc->addField('created', $rec['created']); $doc->addField('created', $rec['created']);
} }

View File

@ -68,17 +68,19 @@ class SeedDMS_SQliteFTS_Search {
} }
if($owner) { if($owner) {
if($querystr) if($querystr)
$querystr .= ' AND '; $querystr .= ' ';
//$querystr .= ' AND ';
$querystr .= 'owner:'.$owner; $querystr .= 'owner:'.$owner;
//$querystr .= $owner;
} }
if($categories) { if($categories) {
if($querystr) if($querystr)
$querystr .= ' AND '; $querystr .= ' ';
//$querystr .= ' AND ';
$querystr .= 'category:'; $querystr .= 'category:';
$querystr .= implode(' OR category:', $categories); $querystr .= implode(' OR category:', $categories);
$querystr .= ''; $querystr .= '';
} }
// echo $querystr;
try { try {
$hits = $this->index->find($querystr); $hits = $this->index->find($querystr);
$recs = array(); $recs = array();

View File

@ -52,9 +52,11 @@ class SeedDMS_SQLiteFTS_Term {
1 => 'comment', 1 => 'comment',
2 => 'keywords', 2 => 'keywords',
3 => 'category', 3 => 'category',
4 => 'owner', 4 => 'mimetype',
5 => 'content', 5 => 'origfilename',
6 => 'created' 6 => 'owner',
7 => 'content',
8 => 'created'
); );
$this->field = $fields[$col]; $this->field = $fields[$col];
$this->_occurrence = $occurrence; $this->_occurrence = $occurrence;

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
// Translators: acabello (20), Admin (948), angel (123), francisco (2), jaimem (14) // Translators: acabello (20), Admin (950), angel (123), francisco (2), jaimem (14)
$text = array( $text = array(
'accept' => 'Aceptar', 'accept' => 'Aceptar',
@ -473,7 +473,7 @@ URL: [url]',
'home_folder' => '', 'home_folder' => '',
'hourly' => 'Horaria', 'hourly' => 'Horaria',
'hours' => 'horas', 'hours' => 'horas',
'hr_HR' => '', 'hr_HR' => 'Croata',
'human_readable' => 'Archivo legible por humanos', 'human_readable' => 'Archivo legible por humanos',
'hu_HU' => 'Hungaro', 'hu_HU' => 'Hungaro',
'id' => 'ID', 'id' => 'ID',
@ -536,7 +536,7 @@ URL: [url]',
'keep_doc_status' => 'Mantener estado del documento', 'keep_doc_status' => 'Mantener estado del documento',
'keywords' => 'Palabras clave', 'keywords' => 'Palabras clave',
'keyword_exists' => 'La palabra clave ya existe', 'keyword_exists' => 'La palabra clave ya existe',
'ko_KR' => '', 'ko_KR' => 'Coreano',
'language' => 'Idioma', 'language' => 'Idioma',
'lastaccess' => 'Último acceso', 'lastaccess' => 'Último acceso',
'last_update' => 'Última modificación', 'last_update' => 'Última modificación',

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
// Translators: Admin (699), pepijn (45), reinoutdijkstra@hotmail.com (270) // Translators: Admin (701), pepijn (45), reinoutdijkstra@hotmail.com (270)
$text = array( $text = array(
'accept' => 'Accept', 'accept' => 'Accept',
@ -466,7 +466,7 @@ URL: [url]',
'home_folder' => '', 'home_folder' => '',
'hourly' => 'Elk uur', 'hourly' => 'Elk uur',
'hours' => 'uren', 'hours' => 'uren',
'hr_HR' => '', 'hr_HR' => 'Kroatisch',
'human_readable' => 'Leesbaar Archief', 'human_readable' => 'Leesbaar Archief',
'hu_HU' => 'Hongaars', 'hu_HU' => 'Hongaars',
'id' => 'ID', 'id' => 'ID',
@ -529,7 +529,7 @@ URL: [url]',
'keep_doc_status' => 'Behoud document status', 'keep_doc_status' => 'Behoud document status',
'keywords' => 'Sleutelwoorden', 'keywords' => 'Sleutelwoorden',
'keyword_exists' => 'Sleutelwoord bestaat al', 'keyword_exists' => 'Sleutelwoord bestaat al',
'ko_KR' => '', 'ko_KR' => 'Koreaans',
'language' => 'Talen', 'language' => 'Talen',
'lastaccess' => '', 'lastaccess' => '',
'last_update' => 'Laatste Update', 'last_update' => 'Laatste Update',

View File

@ -356,7 +356,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
echo "<div class=\"tab-pane ".(($fullsearch == true) ? 'active' : '')."\" id=\"fulltext\">\n"; echo "<div class=\"tab-pane ".(($fullsearch == true) ? 'active' : '')."\" id=\"fulltext\">\n";
$this->contentContainerStart(); $this->contentContainerStart();
?> ?>
<form action="../op/op.Search.php" name="form2" onsubmit="return checkForm();"> <form action="../op/op.Search.php" name="form2" onsubmit="return checkForm();" style="min-height: 330px;">
<input type="hidden" name="fullsearch" value="1" /> <input type="hidden" name="fullsearch" value="1" />
<table class="table-condensed"> <table class="table-condensed">
<tr> <tr>