mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
ce2e6c61d2
|
@ -138,6 +138,18 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
||||||
}
|
}
|
||||||
$this->addField(Zend_Search_Lucene_Field::Text('category', implode(' ', $names), 'utf-8'));
|
$this->addField(Zend_Search_Lucene_Field::Text('category', implode(' ', $names), 'utf-8'));
|
||||||
}
|
}
|
||||||
|
if($acllist = $document->getReadAccessList(1, 1, 1)) {
|
||||||
|
$allu = [];
|
||||||
|
foreach($acllist['users'] as $u)
|
||||||
|
$allu[] = $u->getLogin();
|
||||||
|
$this->addField(Zend_Search_Lucene_Field::Text('users', implode(' ', $allu), 'utf-8'));
|
||||||
|
/*
|
||||||
|
$allg = [];
|
||||||
|
foreach($acllist['groups'] as $g)
|
||||||
|
$allg[] = $g->getName();
|
||||||
|
$this->addField(Zend_Search_Lucene_Field::Text('groups', implode(' ', $allg), 'utf-8'));
|
||||||
|
*/
|
||||||
|
}
|
||||||
if($attributes = $document->getAttributes()) {
|
if($attributes = $document->getAttributes()) {
|
||||||
foreach($attributes as $attribute) {
|
foreach($attributes as $attribute) {
|
||||||
$attrdef = $attribute->getAttributeDefinition();
|
$attrdef = $attribute->getAttributeDefinition();
|
||||||
|
|
|
@ -59,7 +59,7 @@ class SeedDMS_Lucene_Search {
|
||||||
* @param object $index lucene index
|
* @param object $index lucene index
|
||||||
* @return object instance of SeedDMS_Lucene_Search
|
* @return object instance of SeedDMS_Lucene_Search
|
||||||
*/
|
*/
|
||||||
function search($term, $owner, $status='', $categories=array(), $fields=array()) { /* {{{ */
|
function search($term, $owner, $status='', $categories=array(), $fields=array(), $users=array()) { /* {{{ */
|
||||||
$querystr = '';
|
$querystr = '';
|
||||||
if($fields) {
|
if($fields) {
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,6 +78,13 @@ class SeedDMS_Lucene_Search {
|
||||||
$querystr .= implode('" || category:"', $categories);
|
$querystr .= implode('" || category:"', $categories);
|
||||||
$querystr .= '")';
|
$querystr .= '")';
|
||||||
}
|
}
|
||||||
|
if($users) {
|
||||||
|
if($querystr)
|
||||||
|
$querystr .= ' && ';
|
||||||
|
$querystr .= '(users:"';
|
||||||
|
$querystr .= implode('" || users:"', $users);
|
||||||
|
$querystr .= '")';
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$query = Zend_Search_Lucene_Search_QueryParser::parse($querystr);
|
$query = Zend_Search_Lucene_Search_QueryParser::parse($querystr);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
<email>uwe@steinmann.cx</email>
|
<email>uwe@steinmann.cx</email>
|
||||||
<active>yes</active>
|
<active>yes</active>
|
||||||
</lead>
|
</lead>
|
||||||
<date>2018-04-11</date>
|
<date>2020-09-02</date>
|
||||||
<time>10:58:13</time>
|
<time>08:55:43</time>
|
||||||
<version>
|
<version>
|
||||||
<release>1.1.13</release>
|
<release>1.1.14</release>
|
||||||
<api>1.1.13</api>
|
<api>1.1.14</api>
|
||||||
</version>
|
</version>
|
||||||
<stability>
|
<stability>
|
||||||
<release>stable</release>
|
<release>stable</release>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</stability>
|
</stability>
|
||||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
<notes>
|
<notes>
|
||||||
IndexedDocument() remembers cmd and mimetype
|
Index users with at least read access on the document
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
@ -299,5 +299,21 @@ allow conversion commands for mimetypes with wildcards
|
||||||
execWithTimeout() reads data from stderr and saves it into error msg
|
execWithTimeout() reads data from stderr and saves it into error msg
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<date>2018-04-11</date>
|
||||||
|
<time>10:58:13</time>
|
||||||
|
<version>
|
||||||
|
<release>1.1.13</release>
|
||||||
|
<api>1.1.13</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
|
<notes>
|
||||||
|
IndexedDocument() remembers cmd and mimetype
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
</changelog>
|
</changelog>
|
||||||
</package>
|
</package>
|
||||||
|
|
|
@ -150,6 +150,18 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
||||||
if($comment = $document->getComment()) {
|
if($comment = $document->getComment()) {
|
||||||
$this->addField('comment', $comment);
|
$this->addField('comment', $comment);
|
||||||
}
|
}
|
||||||
|
if($acllist = $document->getReadAccessList(1, 1, 1)) {
|
||||||
|
$allu = [];
|
||||||
|
foreach($acllist['users'] as $u)
|
||||||
|
$allu[] = $u->getLogin();
|
||||||
|
$this->addField('users', implode(' ', $allu));
|
||||||
|
/*
|
||||||
|
$allg = [];
|
||||||
|
foreach($acllist['groups'] as $g)
|
||||||
|
$allg[] = $g->getName();
|
||||||
|
$this->addField('groups', implode(' ', $allg));
|
||||||
|
*/
|
||||||
|
}
|
||||||
if($version && !$nocontent) {
|
if($version && !$nocontent) {
|
||||||
$path = $dms->contentDir . $version->getPath();
|
$path = $dms->contentDir . $version->getPath();
|
||||||
if(file_exists($path)) {
|
if(file_exists($path)) {
|
||||||
|
|
|
@ -63,9 +63,9 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
*/
|
*/
|
||||||
$version = SQLite3::version();
|
$version = SQLite3::version();
|
||||||
if($version['versionNumber'] >= 3008000)
|
if($version['versionNumber'] >= 3008000)
|
||||||
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, mimetype, origfilename, owner, content, created, notindexed=created, matchinfo=fts3)';
|
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, mimetype, origfilename, owner, content, created, users, notindexed=created, matchinfo=fts3)';
|
||||||
else
|
else
|
||||||
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, mimetype, origfilename, owner, content, created, matchinfo=fts3)';
|
$sql = 'CREATE VIRTUAL TABLE docs USING fts4(title, comment, keywords, category, mimetype, origfilename, owner, content, created, users, matchinfo=fts3)';
|
||||||
$res = $index->_conn->exec($sql);
|
$res = $index->_conn->exec($sql);
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -96,7 +96,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, 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')).", ".$doc->getFieldValue('created')/*time()*/.")";
|
$sql = "INSERT INTO docs (docid, title, comment, keywords, category, owner, content, mimetype, origfilename, created, users) 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')).", ".$doc->getFieldValue('created').", ".$this->_conn->quote($doc->getFieldValue('users'))/*time()*/.")";
|
||||||
$res = $this->_conn->exec($sql);
|
$res = $this->_conn->exec($sql);
|
||||||
if($res === false) {
|
if($res === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -189,7 +189,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
if(!$this->_conn)
|
if(!$this->_conn)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$sql = "SELECT title, comment, owner, keywords, category, mimetype, origfilename, created FROM docs WHERE docid=".(int) $id;
|
$sql = "SELECT title, comment, owner, keywords, category, mimetype, origfilename, created, users FROM docs WHERE docid=".(int) $id;
|
||||||
$res = $this->_conn->query($sql);
|
$res = $this->_conn->query($sql);
|
||||||
$doc = false;
|
$doc = false;
|
||||||
if($res) {
|
if($res) {
|
||||||
|
@ -203,6 +203,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
||||||
$doc->addField('origfilename', $rec['origfilename']);
|
$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']);
|
||||||
|
$doc->addField('users', $rec['users']);
|
||||||
}
|
}
|
||||||
return $doc;
|
return $doc;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -59,7 +59,7 @@ class SeedDMS_SQliteFTS_Search {
|
||||||
* @param object $index SQlite FTS index
|
* @param object $index SQlite FTS index
|
||||||
* @return object instance of SeedDMS_Lucene_Search
|
* @return object instance of SeedDMS_Lucene_Search
|
||||||
*/
|
*/
|
||||||
function search($term, $owner, $status='', $categories=array(), $fields=array()) { /* {{{ */
|
function search($term, $owner, $status='', $categories=array(), $fields=array(), $users=array()) { /* {{{ */
|
||||||
$querystr = '';
|
$querystr = '';
|
||||||
if($fields) {
|
if($fields) {
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,6 +81,14 @@ class SeedDMS_SQliteFTS_Search {
|
||||||
$querystr .= implode(' OR category:', $categories);
|
$querystr .= implode(' OR category:', $categories);
|
||||||
$querystr .= '';
|
$querystr .= '';
|
||||||
}
|
}
|
||||||
|
if($users) {
|
||||||
|
if($querystr)
|
||||||
|
$querystr .= ' ';
|
||||||
|
//$querystr .= ' AND ';
|
||||||
|
$querystr .= 'users:';
|
||||||
|
$querystr .= implode(' OR users:', $users);
|
||||||
|
$querystr .= '';
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$hits = $this->index->find($querystr);
|
$hits = $this->index->find($querystr);
|
||||||
$recs = array();
|
$recs = array();
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
<email>uwe@steinmann.cx</email>
|
<email>uwe@steinmann.cx</email>
|
||||||
<active>yes</active>
|
<active>yes</active>
|
||||||
</lead>
|
</lead>
|
||||||
<date>2019-11-28</date>
|
<date>2020-09-02</date>
|
||||||
<time>11:00:40</time>
|
<time>08:57:44</time>
|
||||||
<version>
|
<version>
|
||||||
<release>1.0.11</release>
|
<release>1.0.12</release>
|
||||||
<api>1.0.11</api>
|
<api>1.0.12</api>
|
||||||
</version>
|
</version>
|
||||||
<stability>
|
<stability>
|
||||||
<release>stable</release>
|
<release>stable</release>
|
||||||
|
@ -23,8 +23,7 @@
|
||||||
</stability>
|
</stability>
|
||||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
<notes>
|
<notes>
|
||||||
Set 'created' in index to creation date of indexed content (was set to current
|
Index users with at least read access on a document
|
||||||
timestamp)
|
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
@ -243,5 +242,22 @@ execWithTimeout() reads data from stderr and saves it into error msg
|
||||||
IndexedDocument() remembers cmd and mimetype
|
IndexedDocument() remembers cmd and mimetype
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<date>2019-11-28</date>
|
||||||
|
<time>11:00:40</time>
|
||||||
|
<version>
|
||||||
|
<release>1.0.11</release>
|
||||||
|
<api>1.0.11</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
|
<notes>
|
||||||
|
Set 'created' in index to creation date of indexed content (was set to current
|
||||||
|
timestamp)
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
</changelog>
|
</changelog>
|
||||||
</package>
|
</package>
|
||||||
|
|
|
@ -128,7 +128,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
$startTime = getTime();
|
$startTime = getTime();
|
||||||
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
$lucenesearch = new $indexconf['Search']($index);
|
$lucenesearch = new $indexconf['Search']($index);
|
||||||
$hits = $lucenesearch->search($query, $owner ? $owner->getLogin() : '', '', $categorynames);
|
$hits = $lucenesearch->search($query, $owner ? $owner->getLogin() : '', '', $categorynames, array(), $user->isAdmin() ? [] : [$user->getLogin()]);
|
||||||
if($hits === false) {
|
if($hits === false) {
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||||
$totalPages = 0;
|
$totalPages = 0;
|
||||||
|
|
|
@ -282,7 +282,7 @@ $(document).ready( function() {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td></td><td><button type="submit" class="btn"><i class="fa fa-search"></i> <?php printMLText("search"); ?></button></td>
|
<td></td><td><button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> <?php printMLText("search"); ?></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
@ -541,7 +541,7 @@ $(document).ready( function() {
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td><td><button type="submit" class="btn"><i class="fa fa-search"></i> <?php printMLText("search"); ?></button></td>
|
<td></td><td><button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> <?php printMLText("search"); ?></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user