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

Parses Lucene search results. More...

+ Collaboration diagram for ilLuceneSearchResultParser:

Public Member Functions

 __construct ($a_xml)
 Constructor.
 getXML ()
 get xml
 parse (ilLuceneSearchResult $result)
 Parse XML.

Private Attributes

 $xml

Detailed Description

Parses Lucene search results.

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

Definition at line 33 of file class.ilLuceneSearchResultParser.php.

Constructor & Destructor Documentation

ilLuceneSearchResultParser::__construct (   $a_xml)

Constructor.

Parameters
stringsearch result
Returns

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

{
$this->xml = $a_xml;
}

Member Function Documentation

ilLuceneSearchResultParser::getXML ( )

get xml

Parameters
@return

Definition at line 53 of file class.ilLuceneSearchResultParser.php.

References $xml.

Referenced by parse().

{
return $this->xml;
}

+ Here is the caller graph for this function:

ilLuceneSearchResultParser::parse ( ilLuceneSearchResult  $result)

Parse XML.

Parameters
objectilLuceneSearchResult
Returns

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

References ilLuceneSearchResult\addObject(), ilLuceneSearchResult\getLimit(), getXML(), ilLuceneSearchResult\setLimit(), ilLuceneSearchResult\setMaxScore(), and ilLuceneSearchResult\setTotalHits().

{
if(!strlen($this->getXML())) {
return $result;
}
$hits = new SimpleXMLElement($this->getXML());
$result->setLimit($result->getLimit() + (string) $hits['limit']);
$result->setMaxScore( (string) $hits['maxScore']);
$result->setTotalHits((string) $hits['totalHits']);
foreach($hits->children() as $object)
{
$result->addObject((string) $object['id'],(float) $object['absoluteScore']);
}
return $result;
}

+ Here is the call graph for this function:

Field Documentation

ilLuceneSearchResultParser::$xml
private

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

Referenced by getXML().


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