19declare(strict_types=1);
45 $this->max_score = $score;
48 public function getRelevance(
int $obj_id,
int $sub_id,
string $sub_type): float
54 $score = $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'score'] ?? 0;
60 $this->result_string = $a_res;
80 foreach ($root->children() as $object) {
81 $obj_id = (string) $object[
'id'];
82 foreach ($object->children() as $item) {
83 $sub_type = (string) $item[
'type'];
84 $sub_id = (string) $item[
'id'];
86 $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'id'] = $sub_id;
87 $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'type'] = $sub_type;
90 $score = (string) $item[
'absoluteScore'];
91 $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'score'] = $score;
94 foreach ($item->children() as $field) {
95 $name = (string) $field[
'name'];
96 $this->result[$obj_id][$sub_type .
'__' . $sub_id][$name] = (string) $field;
103 public function getTitle(
int $obj_id,
int $sub_id,
string $sub_type): string
105 return $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'title'] ??
'';
108 public function getDescription(
int $obj_id,
int $sub_id,
string $sub_type): string
110 return $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'description'] ??
'';
113 public function getContent(
int $obj_id,
int $sub_id,
string $sub_type): string
115 return $this->result[$obj_id][$sub_type .
'__' . $sub_id][
'content'] ??
'';
124 if (!isset($this->result[$obj_id])) {
127 foreach ($this->result[$obj_id] as
$data) {
128 if (
$data[
'id'] <= 0) {
131 $sub_item_ids[] = [
'id' => (
int)
$data[
'id'],
'type' => (
string)
$data[
'type']];
133 return $sub_item_ids;
static getLogger(string $a_component_id)
Get component logger.
Parses result XML from lucene search highlight.
setResultString(string $a_res)
getTitle(int $obj_id, int $sub_id, string $sub_type)
getSubItemIds(int $obj_id)
setMaxScore(float $score)
getDescription(int $obj_id, int $sub_id, string $sub_type)
getContent(int $obj_id, int $sub_id, string $sub_type)
getRelevance(int $obj_id, int $sub_id, string $sub_type)