mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
set documentid in findById(), getDocument returns content, take out getFolder()
This commit is contained in:
parent
50e8c84932
commit
04c494eaaa
|
@ -165,7 +165,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
|||
* @param string $query
|
||||
* @param array $limit array with elements 'limit' and 'offset'
|
||||
* @return boolean false in case of an error, otherwise array with elements
|
||||
* 'count', 'hits', 'facets'
|
||||
* 'count', 'hits', 'facets'. 'hits' is an array of SeedDMS_SQLiteFTS_QueryHit
|
||||
*/
|
||||
public function find($query, $limit=array()) { /* {{{ */
|
||||
if(!$this->_conn)
|
||||
|
@ -206,20 +206,21 @@ class SeedDMS_SQLiteFTS_Indexer {
|
|||
/**
|
||||
* Get a single document from index
|
||||
*
|
||||
* @param integer $id id of document
|
||||
* @param string $id id of document
|
||||
* @return boolean false in case of an error, otherwise true
|
||||
*/
|
||||
public function findById($id) { /* {{{ */
|
||||
if(!$this->_conn)
|
||||
return false;
|
||||
|
||||
$sql = "SELECT ".$this->_rawid." FROM docs WHERE ".$this->_rawid."=".(int) $id;
|
||||
$sql = "SELECT ".$this->_rawid.", documentid FROM docs WHERE documentid=".$this->_conn->quote($id);
|
||||
$res = $this->_conn->query($sql);
|
||||
$hits = array();
|
||||
if($res) {
|
||||
while($rec = $res->fetch(PDO::FETCH_ASSOC)) {
|
||||
$hit = new SeedDMS_SQLiteFTS_QueryHit($this);
|
||||
$hit->id = $rec[$this->_rawid];
|
||||
$hit->documentid = $rec['documentid'];
|
||||
$hits[] = $hit;
|
||||
}
|
||||
}
|
||||
|
@ -232,11 +233,11 @@ class SeedDMS_SQLiteFTS_Indexer {
|
|||
* @param integer $id id of index record
|
||||
* @return boolean false in case of an error, otherwise true
|
||||
*/
|
||||
public function getDocument($id) { /* {{{ */
|
||||
public function getDocument($id, $content=true) { /* {{{ */
|
||||
if(!$this->_conn)
|
||||
return false;
|
||||
|
||||
$sql = "SELECT ".$this->_rawid.", documentid, title, comment, owner, keywords, category, mimetype, origfilename, created, users, status, path FROM docs WHERE documentid='D".$id."'";
|
||||
$sql = "SELECT ".$this->_rawid.", documentid, title, comment, owner, keywords, category, mimetype, origfilename, created, users, status, path".($content ? ", content" : "")." FROM docs WHERE ".$this->_rawid."='".$id."'";
|
||||
$res = $this->_conn->query($sql);
|
||||
$doc = false;
|
||||
if($res) {
|
||||
|
@ -255,6 +256,8 @@ class SeedDMS_SQLiteFTS_Indexer {
|
|||
$doc->addField('users', $rec['users']);
|
||||
$doc->addField('status', $rec['status']);
|
||||
$doc->addField('path', $rec['path']);
|
||||
if($content)
|
||||
$doc->addField('content', $rec['content']);
|
||||
}
|
||||
return $doc;
|
||||
} /* }}} */
|
||||
|
@ -265,7 +268,7 @@ class SeedDMS_SQLiteFTS_Indexer {
|
|||
* @param integer $id id of folder
|
||||
* @return boolean false in case of an error, otherwise true
|
||||
*/
|
||||
public function getFolder($id) { /* {{{ */
|
||||
public function __getFolder($id) { /* {{{ */
|
||||
if(!$this->_conn)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user