Public Member Functions

ilLuceneIndexer Class Reference

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 130 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 $counter, $files, $query, $res, $row, $tree, and ilUtil::getDataDir().

Referenced by index().

        {
                global $tree;

                $query = "SELECT * FROM file_data ".
                        "WHERE file_type IN ('text/plain','application/pdf','text/html')";

                $res = $this->db->query($query);

                $counter = 0;
                $files = array();
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        ++$counter;
                        $bname = ilUtil::getDataDir();
                        $bname .= ("/files/file_".$row->file_id);
                        $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 100 of file class.ilLuceneIndexer.php.

References $counter, $ilias, $query, $res, and $row.

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: