ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLuceneSearcher Class Reference

Reads and parses lucene search results. More...

+ Collaboration diagram for ilLuceneSearcher:

Public Member Functions

 search ()
 Search.
 highlight ($a_obj_ids)
 Highlight/Detail query.
 nextResultPage ()
 get next result page
 getHighlighter ()
 get highlighter
 getResult ()
 Get result.
 getPageNumber ()
 get current page number

Static Public Member Functions

static getInstance (ilLuceneQueryParser $qp)
 Get singleton instance.

Protected Member Functions

 performSearch ()
 search lucene

Private Member Functions

 __construct ($qp)
 Constructor.

Private Attributes

 $query_parser = null
 $result = null
 $highlighter = null
 $page_number = 1

Static Private Attributes

static $instance = null

Detailed Description

Reads and parses lucene search results.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilLuceneSearcher::__construct (   $qp)
private

Constructor.

Parameters
objectilLuceneQueryParser
Returns

Definition at line 49 of file class.ilLuceneSearcher.php.

{
$this->result = new ilLuceneSearchResult();
$this->result->setCallback(array($this,'nextResultPage'));
$this->query_parser = $qp;
}

Member Function Documentation

ilLuceneSearcher::getHighlighter ( )

get highlighter

Returns

Definition at line 147 of file class.ilLuceneSearcher.php.

References $highlighter.

{
}
static ilLuceneSearcher::getInstance ( ilLuceneQueryParser  $qp)
static

Get singleton instance.

Parameters
objectilLuceneQueryParser
Returns

Definition at line 63 of file class.ilLuceneSearcher.php.

References $instance.

Referenced by ilLuceneAdvancedSearchGUI\performSearch(), ilLuceneSearchGUI\performSearch(), ilLuceneAdvancedSearchGUI\showSavedResults(), and ilLuceneSearchGUI\showSavedResults().

{
if(self::$instance)
{
}
return self::$instance = new ilLuceneSearcher($qp);
}

+ Here is the caller graph for this function:

ilLuceneSearcher::getPageNumber ( )

get current page number

Parameters
@return

Definition at line 171 of file class.ilLuceneSearcher.php.

References $page_number.

Referenced by performSearch().

{
}

+ Here is the caller graph for this function:

ilLuceneSearcher::getResult ( )

Get result.

Parameters
@return

Definition at line 157 of file class.ilLuceneSearcher.php.

References $result.

{
if($this->result instanceof ilLuceneSearchResult)
{
return $this->result;
}
// TODO Error handling
}
ilLuceneSearcher::highlight (   $a_obj_ids)

Highlight/Detail query.

Parameters
array$a_obj_idsArry of obj_ids
Returns
object ilLuceneHighlightResultParser

Definition at line 86 of file class.ilLuceneSearcher.php.

References $highlighter, $ilBench, $ilLog, $ilSetting, $res, and ilRpcClientFactory\factory().

{
include_once './Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
// TODO error handling
if(!$this->query_parser->getQuery())
{
return;
}
// Search in combined index
$ilBench->start('Lucene','SearchHighlight');
try
{
include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
$res = ilRpcClientFactory::factory('RPCSearchHandler')->highlight(
CLIENT_ID.'_'.$ilSetting->get('inst_id',0),
$a_obj_ids,
$this->query_parser->getQuery()
);
}
{
// TODO: better error handling
$ilLog->write(__METHOD__.': '.$e->getMessage());
}
catch(Exception $e)
{
$ilLog->write(__METHOD__.': '.$e->getMessage());
}
$ilBench->stop('Lucene','SearchHighlight');
$ilBench->start('Lucene','SearchHighlightParser');
include_once './Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
$this->highlighter = new ilLuceneHighlighterResultParser();
$this->highlighter->setResultString($res);
$this->highlighter->parse();
$ilBench->stop('Lucene','SearchHighlightParser');
}

+ Here is the call graph for this function:

ilLuceneSearcher::nextResultPage ( )

get next result page

Parameters
@return

Definition at line 137 of file class.ilLuceneSearcher.php.

References performSearch().

{
$this->page_number++;
$this->performSearch();
}

+ Here is the call graph for this function:

ilLuceneSearcher::performSearch ( )
protected

search lucene

Returns

Definition at line 180 of file class.ilLuceneSearcher.php.

References $ilBench, $ilLog, $ilSetting, $res, ilRpcClientFactory\factory(), and getPageNumber().

Referenced by nextResultPage(), and search().

{
// TODO error handling
if(!$this->query_parser->getQuery())
{
return;
}
$ilBench->start('Lucene','SearchCombinedIndex');
try
{
include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
$res = ilRpcClientFactory::factory('RPCSearchHandler')->search(
CLIENT_ID.'_'.$ilSetting->get('inst_id',0),
(string) $this->query_parser->getQuery(),
$this->getPageNumber()
);
}
{
// TODO: better error handling
$ilBench->stop('Lucene','SearchCombinedIndex');
$ilLog->write(__METHOD__.': '.$e->getMessage());
return;
}
catch(Exception $e)
{
$ilBench->stop('Lucene','SearchCombinedIndex');
$ilLog->write(__METHOD__.': '.$e->getMessage());
return;
}
$ilBench->stop('Lucene','SearchCombinedIndex');
// Parse results
$ilBench->start('Lucene','ParseSearchResult');
include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultParser.php';
$parser->parse($this->result);
$ilBench->stop('Lucene','ParseSearchResult');
return;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneSearcher::search ( )

Search.

Returns

Definition at line 76 of file class.ilLuceneSearcher.php.

References performSearch().

{
$this->performSearch();
}

+ Here is the call graph for this function:

Field Documentation

ilLuceneSearcher::$highlighter = null
private

Definition at line 41 of file class.ilLuceneSearcher.php.

Referenced by getHighlighter(), and highlight().

ilLuceneSearcher::$instance = null
staticprivate

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

Referenced by getInstance().

ilLuceneSearcher::$page_number = 1
private

Definition at line 42 of file class.ilLuceneSearcher.php.

Referenced by getPageNumber().

ilLuceneSearcher::$query_parser = null
private

Definition at line 39 of file class.ilLuceneSearcher.php.

ilLuceneSearcher::$result = null
private

Definition at line 40 of file class.ilLuceneSearcher.php.

Referenced by getResult().


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