ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLuceneHighlighterResultParser Class Reference

Parses result XML from lucene search highlight. More...

+ Collaboration diagram for ilLuceneHighlighterResultParser:

Public Member Functions

 __construct ()
 Contructor.
 getMaxScore ()
 setMaxScore ($a_score)
 getRelevance ($a_obj_id, $sub_id)
 get relevance
 setResultString ($a_res)
 set result xml string
 getResultString ()
 get result xml string
 parse ()
 parse
 getTitle ($a_obj_id, $a_sub_id)
 get title
 getDescription ($a_obj_id, $a_sub_id)
 get description
 getContent ($a_obj_id, $a_sub_id)
 get content
 getSubItemIds ($a_obj_id)
 get subitem ids

Private Attributes

 $result_string = ''
 $result = array()
 $max_score = 0

Detailed Description

Parses result XML from lucene search highlight.

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

Definition at line 34 of file class.ilLuceneHighlighterResultParser.php.

Constructor & Destructor Documentation

ilLuceneHighlighterResultParser::__construct ( )

Contructor.

Returns

Definition at line 48 of file class.ilLuceneHighlighterResultParser.php.

{
}

Member Function Documentation

ilLuceneHighlighterResultParser::getContent (   $a_obj_id,
  $a_sub_id 
)

get content

Parameters
intobj_id
intsub_item
Returns

Definition at line 170 of file class.ilLuceneHighlighterResultParser.php.

{
return isset($this->result[$a_obj_id][$a_sub_id]['content']) ? $this->result[$a_obj_id][$a_sub_id]['content'] : null;
}
ilLuceneHighlighterResultParser::getDescription (   $a_obj_id,
  $a_sub_id 
)

get description

Parameters
intobj_id
intsub_item
Returns

Definition at line 159 of file class.ilLuceneHighlighterResultParser.php.

{
return isset($this->result[$a_obj_id][$a_sub_id]['description']) ? $this->result[$a_obj_id][$a_sub_id]['description'] : null;
}
ilLuceneHighlighterResultParser::getMaxScore ( )

Definition at line 54 of file class.ilLuceneHighlighterResultParser.php.

References $max_score.

Referenced by getRelevance().

{
}

+ Here is the caller graph for this function:

ilLuceneHighlighterResultParser::getRelevance (   $a_obj_id,
  $sub_id 
)

get relevance

Parameters
intobj_id
Returns
int relevance in percent

Definition at line 69 of file class.ilLuceneHighlighterResultParser.php.

References getMaxScore().

{
if(!$this->getMaxScore())
{
return 0;
}
$score = $this->result[$a_obj_id][$sub_id]['score'];
return $score / $this->getMaxScore() * 100;
}

+ Here is the call graph for this function:

ilLuceneHighlighterResultParser::getResultString ( )

get result xml string

Parameters
@return

Definition at line 97 of file class.ilLuceneHighlighterResultParser.php.

References $result_string.

Referenced by parse().

{
}

+ Here is the caller graph for this function:

ilLuceneHighlighterResultParser::getSubItemIds (   $a_obj_id)

get subitem ids

Parameters
@return

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

{
$sub_item_ids = array();
if(!isset($this->result[$a_obj_id]))
{
return array();
}
foreach($this->result[$a_obj_id] as $sub_item_id => $data)
{
if($sub_item_id)
{
$sub_item_ids[] = $sub_item_id;
}
}
return $sub_item_ids ? $sub_item_ids : array();
}
ilLuceneHighlighterResultParser::getTitle (   $a_obj_id,
  $a_sub_id 
)

get title

Parameters
intobj_id
intsub_item
Returns

Definition at line 148 of file class.ilLuceneHighlighterResultParser.php.

{
return isset($this->result[$a_obj_id][$a_sub_id]['title']) ? $this->result[$a_obj_id][$a_sub_id]['title'] : null;
}
ilLuceneHighlighterResultParser::parse ( )

parse

Returns

Definition at line 106 of file class.ilLuceneHighlighterResultParser.php.

References getResultString(), and setMaxScore().

{
if(!strlen($this->getResultString()))
{
return false;
}
$root = new SimpleXMLElement($this->getResultString());
// begin-patch mime_filter
$this->setMaxScore((string) $root['maxScore']);
// end-patch mime_filter
foreach($root->children() as $object)
{
$obj_id = (string) $object['id'];
foreach($object->children() as $item)
{
$sub_id = (string) $item['id'];
// begin-patch mime_filter
$score = (string) $item['absoluteScore'];
$this->result[$obj_id][$sub_id]['score'] = $score;
// end-patch mime_filter
foreach($item->children() as $field)
{
$name = (string) $field['name'];
$this->result[$obj_id][$sub_id][$name] = (string) $field;
}
}
}
return true;
}

+ Here is the call graph for this function:

ilLuceneHighlighterResultParser::setMaxScore (   $a_score)

Definition at line 59 of file class.ilLuceneHighlighterResultParser.php.

Referenced by parse().

{
$this->max_score = $a_score;
}

+ Here is the caller graph for this function:

ilLuceneHighlighterResultParser::setResultString (   $a_res)

set result xml string

Parameters
@return

Definition at line 87 of file class.ilLuceneHighlighterResultParser.php.

{
$this->result_string = $a_res;
}

Field Documentation

ilLuceneHighlighterResultParser::$max_score = 0
private

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

Referenced by getMaxScore().

ilLuceneHighlighterResultParser::$result = array()
private

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

ilLuceneHighlighterResultParser::$result_string = ''
private

Definition at line 36 of file class.ilLuceneHighlighterResultParser.php.

Referenced by getResultString().


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