index mimetype and orgfilename

This commit is contained in:
Uwe Steinmann 2015-08-12 17:12:41 +02:00
parent de7d7c2dbc
commit 36fff2cfcb

View File

@ -57,7 +57,7 @@ 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)'; $sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, mimetype, orgfilename, 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 +88,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, orgfilename, 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('orgfilename')).", ".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 +180,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, orgfilename, 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 +190,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('orgfilename', $rec['orgfilename']);
$doc->addField('owner', $rec['owner']); $doc->addField('owner', $rec['owner']);
$doc->addField('created', $rec['created']); $doc->addField('created', $rec['created']);
} }