xref: /dokuwiki/inc/Remote/Response/PageHit.php (revision 6cce3332fbc12c1e250ec7e6adbad6d4dc2c74e8)
1*6cce3332SAndreas Gohr<?php
2*6cce3332SAndreas Gohr
3*6cce3332SAndreas Gohrnamespace dokuwiki\Remote\Response;
4*6cce3332SAndreas Gohr
5*6cce3332SAndreas Gohr/**
6*6cce3332SAndreas Gohr * Represents a page found by a search
7*6cce3332SAndreas Gohr */
8*6cce3332SAndreas Gohrclass PageHit extends Page
9*6cce3332SAndreas Gohr{
10*6cce3332SAndreas Gohr    /** @var int The number of hits this result got */
11*6cce3332SAndreas Gohr    public $score;
12*6cce3332SAndreas Gohr
13*6cce3332SAndreas Gohr    /** @var string The HTML formatted snippet in which the search term was found (if available) */
14*6cce3332SAndreas Gohr    public $snippet;
15*6cce3332SAndreas Gohr
16*6cce3332SAndreas Gohr    /** @var string Not available for search results */
17*6cce3332SAndreas Gohr    public $hash;
18*6cce3332SAndreas Gohr
19*6cce3332SAndreas Gohr    /** @var string Not available for search results */
20*6cce3332SAndreas Gohr    public $author;
21*6cce3332SAndreas Gohr
22*6cce3332SAndreas Gohr    /** @inheritdoc */
23*6cce3332SAndreas Gohr    public function __construct($data)
24*6cce3332SAndreas Gohr    {
25*6cce3332SAndreas Gohr        parent::__construct($data);
26*6cce3332SAndreas Gohr
27*6cce3332SAndreas Gohr        $this->snippet = $data['snippet'] ?? '';
28*6cce3332SAndreas Gohr        $this->score = (int)($data['score'] ?? 0);
29*6cce3332SAndreas Gohr    }
30*6cce3332SAndreas Gohr}
31