ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLuceneIndexer Class Reference
+ Collaboration diagram for ilLuceneIndexer:

Public Member Functions

 ilLuceneIndexer ()
 index ()
 __indexFiles ()
 __indexHTLMs ()
 __flushIndex ()

Detailed Description

Definition at line 35 of file class.ilLuceneIndexer.php.

Member Function Documentation

ilLuceneIndexer::__flushIndex ( )

Definition at line 133 of file class.ilLuceneIndexer.php.

Referenced by index().

{
include_once './Services/Search/classes/Lucene/class.ilLuceneRPCAdapter.php';
$rpc_adapter =& new ilLuceneRPCAdapter();
$rpc_adapter->setMode('flush');
if($rpc_adapter->send())
{
$this->log->write('Lucene indexer: deleted index');
}
return true;
}

+ Here is the caller graph for this function:

ilLuceneIndexer::__indexFiles ( )

Definition at line 56 of file class.ilLuceneIndexer.php.

References $files, $res, ilFileSystemStorage\_createPathFromId(), DB_FETCHMODE_OBJECT, and ilUtil\getDataDir().

Referenced by index().

{
include_once('Services/FileSystemStorage/classes/class.ilFileSystemStorage.php');
global $tree;
$query = "SELECT * FROM file_data ".
"WHERE file_type IN ('text/plain','application/pdf','text/html','text/x-pdf','application/x-pdf')";
$res = $this->db->query($query);
$counter = 0;
$files = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
++$counter;
$bname = ilUtil::getDataDir();
$bname .= ("/ilFiles/");
$bname .= ilFileSystemStorage::_createPathFromId($row->file_id,'file');
$vname = (sprintf("%03d", $row->version));
if(is_file($bname.'/'.$vname.'/'.$row->file_name))
{
$files[$row->file_id] = $bname.'/'.$vname.'/'.$row->file_name;
}
else
{
$files[$row->file_id] = $bname.'/'.$row->file_name;
}
}
$this->log->write('Lucene indexer: Found '.$counter.' files for indexing');
if(count($files))
{
// Send files to lucene rpc server
include_once './Services/Search/classes/Lucene/class.ilLuceneRPCAdapter.php';
$rpc_adapter =& new ilLuceneRPCAdapter();
$rpc_adapter->setMode('file');
$rpc_adapter->setFiles($files);
if($rpc_adapter->send())
{
$this->log->write('Lucene indexer: files sent');
}
return true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneIndexer::__indexHTLMs ( )

Definition at line 103 of file class.ilLuceneIndexer.php.

References $res, DB_FETCHMODE_OBJECT, ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

Referenced by index().

{
global $ilias;
$query = "SELECT * FROM object_data WHERE type = 'htlm'";
$res = $this->db->query($query);
$counter = 0;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
++$counter;
$lms[$row->obj_id] = ILIAS_ABSOLUTE_PATH.'/'.ILIAS_WEB_DIR.'/'.CLIENT_ID.'/lm_data/lm_'.$row->obj_id;
}
$this->log->write('Lucene indexer: Found '.$counter.' html learning modules for indexing');
if(count($lms))
{
// Send files to lucene rpc server
include_once './Services/Search/classes/Lucene/class.ilLuceneRPCAdapter.php';
$rpc_adapter =& new ilLuceneRPCAdapter();
$rpc_adapter->setMode('htlm');
$rpc_adapter->setHTLMs($lms);
if($rpc_adapter->send())
{
$this->log->write('Lucene indexer: files sent');
}
return true;
}
}

+ Here is the caller graph for this function:

ilLuceneIndexer::ilLuceneIndexer ( )

Definition at line 37 of file class.ilLuceneIndexer.php.

References $ilLog.

{
global $ilLog,$ilDB;
$this->log =& $ilLog;
$this->db =& $ilDB;
}
ilLuceneIndexer::index ( )

Definition at line 45 of file class.ilLuceneIndexer.php.

References __flushIndex(), __indexFiles(), and __indexHTLMs().

{
// Todo check in settings which objects should be indexed
$this->__flushIndex();
$this->__indexFiles();
$this->__indexHTLMs();
return true;
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: