mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
9e9c0c8ac5
|
@ -149,8 +149,9 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
||||||
if($version) {
|
if($version) {
|
||||||
$this->addField(Zend_Search_Lucene_Field::Keyword('mimetype', $version->getMimeType()));
|
$this->addField(Zend_Search_Lucene_Field::Keyword('mimetype', $version->getMimeType()));
|
||||||
$this->addField(Zend_Search_Lucene_Field::Keyword('origfilename', $version->getOriginalFileName(), 'utf-8'));
|
$this->addField(Zend_Search_Lucene_Field::Keyword('origfilename', $version->getOriginalFileName(), 'utf-8'));
|
||||||
|
$this->addField(Zend_Search_Lucene_Field::UnIndexed('created', $version->getDate()));
|
||||||
if(!$nocontent)
|
if(!$nocontent)
|
||||||
$this->addField(Zend_Search_Lucene_Field::UnIndexed('created', $version->getDate()));
|
$this->addField(Zend_Search_Lucene_Field::UnIndexed('indexed', time()));
|
||||||
if($attributes = $version->getAttributes()) {
|
if($attributes = $version->getAttributes()) {
|
||||||
foreach($attributes as $attribute) {
|
foreach($attributes as $attribute) {
|
||||||
$attrdef = $attribute->getAttributeDefinition();
|
$attrdef = $attribute->getAttributeDefinition();
|
||||||
|
|
|
@ -151,8 +151,9 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
||||||
if($version) {
|
if($version) {
|
||||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('mimetype', $version->getMimeType()));
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('mimetype', $version->getMimeType()));
|
||||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('origfilename', $version->getOriginalFileName()));
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('origfilename', $version->getOriginalFileName()));
|
||||||
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $version->getDate(), 'unindexed'));
|
||||||
if(!$nocontent)
|
if(!$nocontent)
|
||||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $version->getDate(), 'unindexed'));
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('indexed', time(), 'unindexed'));
|
||||||
if($attributes = $version->getAttributes()) {
|
if($attributes = $version->getAttributes()) {
|
||||||
foreach($attributes as $attribute) {
|
foreach($attributes as $attribute) {
|
||||||
$attrdef = $attribute->getAttributeDefinition();
|
$attrdef = $attribute->getAttributeDefinition();
|
||||||
|
@ -226,6 +227,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
||||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('document_id', 'F'.$document->getID()));
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('document_id', 'F'.$document->getID()));
|
||||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('record_type', 'folder'));
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('record_type', 'folder'));
|
||||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $document->getDate(), 'unindexed'));
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $document->getDate(), 'unindexed'));
|
||||||
|
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('indexed', time(), 'unindexed'));
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
|
|
@ -77,9 +77,9 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
$version = SQLite3::version();
|
$version = SQLite3::version();
|
||||||
if(self::ftstype == 'fts4') {
|
if(self::ftstype == 'fts4') {
|
||||||
if($version['versionNumber'] >= 3008000)
|
if($version['versionNumber'] >= 3008000)
|
||||||
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(documentid, record_type, title, comment, keywords, category, mimetype, origfilename, owner, content, created, users, status, path, notindexed=created, matchinfo=fts3)';
|
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(documentid, record_type, title, comment, keywords, category, mimetype, origfilename, owner, content, created, indexed, users, status, path, notindexed=created, notindexed=indexed, matchinfo=fts3)';
|
||||||
else
|
else
|
||||||
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(documentid, record_type, title, comment, keywords, category, mimetype, origfilename, owner, content, created, users, status, path, matchinfo=fts3)';
|
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(documentid, record_type, title, comment, keywords, category, mimetype, origfilename, owner, content, created, indexed, users, status, path, matchinfo=fts3)';
|
||||||
$res = $index->_conn->exec($sql);
|
$res = $index->_conn->exec($sql);
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -90,7 +90,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} elseif(self::ftstype == 'fts5') {
|
} elseif(self::ftstype == 'fts5') {
|
||||||
$sql = 'CREATE VIRTUAL TABLE docs USING fts5(documentid, record_type, title, comment, keywords, category, mimetype, origfilename, owner, content, created unindexed, users, status, path)';
|
$sql = 'CREATE VIRTUAL TABLE docs USING fts5(documentid, record_type, title, comment, keywords, category, mimetype, origfilename, owner, content, created unindexed, indexed unindexed, users, status, path)';
|
||||||
$res = $index->_conn->exec($sql);
|
$res = $index->_conn->exec($sql);
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -123,7 +123,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
if(!$this->_conn)
|
if(!$this->_conn)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach(array('comment', 'keywords', 'category', 'content', 'mimetype', 'origfilename', 'status', 'created') as $kk) {
|
foreach(array('comment', 'keywords', 'category', 'content', 'mimetype', 'origfilename', 'status', 'created', 'indexed') as $kk) {
|
||||||
try {
|
try {
|
||||||
${$kk} = $doc->getFieldValue($kk);
|
${$kk} = $doc->getFieldValue($kk);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -135,7 +135,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$sql = "INSERT INTO docs (documentid, record_type, title, comment, keywords, category, owner, content, mimetype, origfilename, created, users, status, path) VALUES (".$this->_conn->quote($doc->getFieldValue('document_id')).", ".$this->_conn->quote($doc->getFieldValue('record_type')).", ".$this->_conn->quote($doc->getFieldValue('title')).", ".$this->_conn->quote($comment).", ".$this->_conn->quote($keywords).", ".$this->_conn->quote($category).", ".$this->_conn->quote($doc->getFieldValue('owner')).", ".$this->_conn->quote($content).", ".$this->_conn->quote($mimetype).", ".$this->_conn->quote($origfilename).", ".(int)$created.", ".$this->_conn->quote($doc->getFieldValue('users')).", ".$this->_conn->quote($status).", ".$this->_conn->quote($doc->getFieldValue('path'))/*time()*/.")";
|
$sql = "INSERT INTO docs (documentid, record_type, title, comment, keywords, category, owner, content, mimetype, origfilename, created, indexed, users, status, path) VALUES (".$this->_conn->quote($doc->getFieldValue('document_id')).", ".$this->_conn->quote($doc->getFieldValue('record_type')).", ".$this->_conn->quote($doc->getFieldValue('title')).", ".$this->_conn->quote($comment).", ".$this->_conn->quote($keywords).", ".$this->_conn->quote($category).", ".$this->_conn->quote($doc->getFieldValue('owner')).", ".$this->_conn->quote($content).", ".$this->_conn->quote($mimetype).", ".$this->_conn->quote($origfilename).", ".(int)$created.", ".(int)$indexed.", ".$this->_conn->quote($doc->getFieldValue('users')).", ".$this->_conn->quote($status).", ".$this->_conn->quote($doc->getFieldValue('path'))/*time()*/.")";
|
||||||
$res = $this->_conn->exec($sql);
|
$res = $this->_conn->exec($sql);
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -324,7 +324,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
if(!$this->_conn)
|
if(!$this->_conn)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$sql = "SELECT ".$this->_rawid.", documentid, title, comment, owner, keywords, category, mimetype, origfilename, created, users, status, path".($content ? ", content" : "")." FROM docs WHERE ".$this->_rawid."='".$id."'";
|
$sql = "SELECT ".$this->_rawid.", documentid, title, comment, owner, keywords, category, mimetype, origfilename, created, indexed, users, status, path".($content ? ", content" : "")." FROM docs WHERE ".$this->_rawid."='".$id."'";
|
||||||
$res = $this->_conn->query($sql);
|
$res = $this->_conn->query($sql);
|
||||||
$doc = false;
|
$doc = false;
|
||||||
if($res) {
|
if($res) {
|
||||||
|
@ -341,6 +341,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('origfilename', $rec['origfilename']));
|
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('origfilename', $rec['origfilename']));
|
||||||
$doc->addField(SeedDMS_SQLiteFTS_Field::Text('owner', $rec['owner']));
|
$doc->addField(SeedDMS_SQLiteFTS_Field::Text('owner', $rec['owner']));
|
||||||
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $rec['created']));
|
$doc->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $rec['created']));
|
||||||
|
$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', $rec['path']));
|
||||||
|
|
|
@ -53,6 +53,7 @@ class SeedDMS_SQLiteFTS_QueryHit {
|
||||||
*/
|
*/
|
||||||
public function __construct(SeedDMS_SQLiteFTS_Indexer $index) { /* {{{ */
|
public function __construct(SeedDMS_SQLiteFTS_Indexer $index) { /* {{{ */
|
||||||
$this->_index = $index;
|
$this->_index = $index;
|
||||||
|
$this->_document = null;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,7 +60,8 @@ class SeedDMS_SQLiteFTS_Term {
|
||||||
9 => 'created',
|
9 => 'created',
|
||||||
10 => 'user',
|
10 => 'user',
|
||||||
11 => 'status',
|
11 => 'status',
|
||||||
12 => 'path'
|
12 => 'path',
|
||||||
|
13 => 'indexed',
|
||||||
);
|
);
|
||||||
/* fts5 pass the column name in $col, fts4 uses an integer */
|
/* fts5 pass the column name in $col, fts4 uses an integer */
|
||||||
if(is_int($col))
|
if(is_int($col))
|
||||||
|
|
|
@ -42,17 +42,17 @@ class SeedDMS_View_Indexer_Process_Folder { /* {{{ */
|
||||||
if(($this->numdocs == 0) || !($hit = $lucenesearch->getFolder($folder->getId()))) {
|
if(($this->numdocs == 0) || !($hit = $lucenesearch->getFolder($folder->getId()))) {
|
||||||
echo " <span id=\"status_F".$folder->getID()."\" class=\"indexme indexstatus\" data-docid=\"F".$folder->getID()."\">".getMLText('index_waiting')."</span>";
|
echo " <span id=\"status_F".$folder->getID()."\" class=\"indexme indexstatus\" data-docid=\"F".$folder->getID()."\">".getMLText('index_waiting')."</span>";
|
||||||
} else {
|
} else {
|
||||||
/* Check if the attribute created is set or has a value older
|
/* Check if the attribute indexed is set or has a value older
|
||||||
* than the lastet content. Documents without such an attribute
|
* than the lastet content. Documents without such an attribute
|
||||||
* where added when a new document was added to the dms. In such
|
* where added when a new document was added to the dms. In such
|
||||||
* a case the document content wasn't indexed.
|
* a case the document content wasn't indexed.
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
$created = (int) $hit->getDocument()->getFieldValue('created');
|
$indexed = (int) $hit->getDocument()->getFieldValue('indexed');
|
||||||
} catch (/* Zend_Search_Lucene_ */Exception $e) {
|
} catch (/* Zend_Search_Lucene_ */Exception $e) {
|
||||||
$created = 0;
|
$indexed = 0;
|
||||||
}
|
}
|
||||||
if($created >= $folder->getDate() && !$this->forceupdate) {
|
if($indexed >= $folder->getDate() && !$this->forceupdate) {
|
||||||
echo "<span id=\"status_F".$folder->getID()."\" class=\"indexstatus\" data-docid=\"F".$folder->getID()."\">".getMLText('index_document_unchanged')."</span>";
|
echo "<span id=\"status_F".$folder->getID()."\" class=\"indexstatus\" data-docid=\"F".$folder->getID()."\">".getMLText('index_document_unchanged')."</span>";
|
||||||
} else {
|
} else {
|
||||||
$this->fulltextservice->Indexer()->delete($hit->id);
|
$this->fulltextservice->Indexer()->delete($hit->id);
|
||||||
|
@ -70,18 +70,18 @@ class SeedDMS_View_Indexer_Process_Folder { /* {{{ */
|
||||||
if(($this->numdocs == 0) || !($hit = $lucenesearch->getDocument($document->getId()))) {
|
if(($this->numdocs == 0) || !($hit = $lucenesearch->getDocument($document->getId()))) {
|
||||||
echo " <span id=\"status_D".$document->getID()."\" class=\"indexme indexstatus\" data-docid=\"D".$document->getID()."\">".getMLText('index_waiting')."</span>";
|
echo " <span id=\"status_D".$document->getID()."\" class=\"indexme indexstatus\" data-docid=\"D".$document->getID()."\">".getMLText('index_waiting')."</span>";
|
||||||
} else {
|
} else {
|
||||||
/* Check if the attribute created is set or has a value older
|
/* Check if the attribute indexed is set or has a value older
|
||||||
* than the lastet content. Documents without such an attribute
|
* than the lastet content. Documents without such an attribute
|
||||||
* where added when a new document was added to the dms. In such
|
* where added when a new document was added to the dms. In such
|
||||||
* a case the document content wasn't indexed.
|
* a case the document content wasn't indexed.
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
$created = (int) $hit->getDocument()->getFieldValue('created');
|
$indexed = (int) $hit->getDocument()->getFieldValue('indexed');
|
||||||
} catch (/* Zend_Search_Lucene_ */Exception $e) {
|
} catch (/* Zend_Search_Lucene_ */Exception $e) {
|
||||||
$created = 0;
|
$indexed = 0;
|
||||||
}
|
}
|
||||||
$content = $document->getLatestContent();
|
$content = $document->getLatestContent();
|
||||||
if($created >= $content->getDate() && !$this->forceupdate) {
|
if($indexed >= $content->getDate() && !$this->forceupdate) {
|
||||||
echo "<span id=\"status_D".$document->getID()."\" class=\"indexstatus\" data-docid=\"D".$document->getID()."\">".getMLText('index_document_unchanged')."</span>";
|
echo "<span id=\"status_D".$document->getID()."\" class=\"indexstatus\" data-docid=\"D".$document->getID()."\">".getMLText('index_document_unchanged')."</span>";
|
||||||
} else {
|
} else {
|
||||||
$this->fulltextservice->Indexer()->delete($hit->id);
|
$this->fulltextservice->Indexer()->delete($hit->id);
|
||||||
|
@ -132,7 +132,7 @@ function check_queue() {
|
||||||
}
|
}
|
||||||
var command = '';
|
var command = '';
|
||||||
docid = funcArray.pop();
|
docid = funcArray.pop();
|
||||||
$('#status_'+docid).html('Processsing ...');
|
$('#status_'+docid).html('<?= getMLText('index_processing') ?>');
|
||||||
if(docid[0] == 'F') {
|
if(docid[0] == 'F') {
|
||||||
command = 'indexfolder';
|
command = 'indexfolder';
|
||||||
} else {
|
} else {
|
||||||
|
@ -161,11 +161,11 @@ function check_queue() {
|
||||||
// console.log('success ' + data.data);
|
// console.log('success ' + data.data);
|
||||||
if(data.success) {
|
if(data.success) {
|
||||||
if(data.cmd)
|
if(data.cmd)
|
||||||
$('#status_'+data.data).html('<?php printMLText('index_done'); ?>');
|
$('#status_'+data.data).html('<?= getMLText('index_done') ?>');
|
||||||
else
|
else
|
||||||
$('#status_'+data.data).html('<?= getMLText('index_done').' ('.getMLText('index_no_content').')'; ?>');
|
$('#status_'+data.data).html('<?= getMLText('index_done').' ('.getMLText('index_no_content').')' ?>');
|
||||||
} else {
|
} else {
|
||||||
$('#status_'+data.data).html('<?php printMLText('index_error'); ?>');
|
$('#status_'+data.data).html('<?= getMLText('index_error') ?>');
|
||||||
noty({
|
noty({
|
||||||
text: '<p><strong>Docid: ' + data.data + ' (' + data.mimetype + ')</strong></p>' + '<p>Cmd: ' + data.cmd + '</p>' + data.message,
|
text: '<p><strong>Docid: ' + data.data + ' (' + data.mimetype + ')</strong></p>' + '<p>Cmd: ' + data.cmd + '</p>' + data.message,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -196,7 +196,7 @@ $(document).ready( function() {
|
||||||
$('.indexme').each(function(index) {
|
$('.indexme').each(function(index) {
|
||||||
var element = $(this);
|
var element = $(this);
|
||||||
var docid = element.data('docid');
|
var docid = element.data('docid');
|
||||||
element.html('<?php printMLText('index_pending'); ?>');
|
element.html('<?= getMLText('index_pending') ?>');
|
||||||
funcArray.push(docid);
|
funcArray.push(docid);
|
||||||
});
|
});
|
||||||
docstoindex = funcArray.length;
|
docstoindex = funcArray.length;
|
||||||
|
@ -235,13 +235,13 @@ div.folder {font-weight: bold; line-height: 20px; margin-top: 10px;}
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar bar total-bar" role="progressbar" style="width: 100%;"></div>
|
<div class="progress-bar bar total-bar" role="progressbar" style="width: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bar-legend"><?php printMLText('overall_indexing_progress'); ?></div>
|
<div class="bar-legend"><?= getMLText('overall_indexing_progress') ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar bar queue-bar" role="progressbar" style="width: 100%;"></div>
|
<div class="progress-bar bar queue-bar" role="progressbar" style="width: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bar-legend"><?php printMLText('indexing_tasks_in_queue'); ?></div>
|
<div class="bar-legend"><?= getMLText('indexing_tasks_in_queue') ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$folderprocess = new SeedDMS_View_Indexer_Process_Folder($fulltextservice, $forceupdate);
|
$folderprocess = new SeedDMS_View_Indexer_Process_Folder($fulltextservice, $forceupdate);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user