class Result in Google Search Appliance 8
Defines a value object representing a search result.
Hierarchy
- class \Drupal\google_appliance\SearchResults\Result
Expanded class hierarchy of Result
2 files declare their use of Result
- Parser.php in src/
Service/ Parser.php - TestSearch.php in tests/
modules/ google_appliance_test/ src/ TestSearch.php
File
- src/
SearchResults/ Result.php, line 11
Namespace
Drupal\google_appliance\SearchResultsView source
class Result {
/**
* Absolute URL.
*
* @var string
*/
protected $absoluteUrl = '';
/**
* Encoded URL.
*
* @var string
*/
protected $encodedUrl = '';
/**
* Short URL.
*
* @var string
*/
protected $shortUrl = '';
/**
* Title.
*
* @var string
*/
protected $title = '';
/**
* Snippet.
*
* @var string
*/
protected $snippet = '';
/**
* Crawl Date.
*
* @var string
*/
protected $crawlDate = '';
/**
* Array of meta values keyed by name.
*
* @var string[]
*/
protected $meta = [];
/**
* Mime Type.
*
* @var string
*/
protected $mimeType = '';
/**
* Level.
*
* @var int
*/
protected $level = 1;
/**
* Constructs a new Result object.
*
* @param string $absoluteUrl
* Absolute URL.
* @param string $encodedUrl
* Encoded URL.
* @param string $title
* Title.
* @param string $snippet
* Snippet.
* @param string $crawlDate
* Crawl date.
* @param string $mimeType
* Mime Type.
* @param int $level
* Level.
*/
public function __construct($absoluteUrl, $encodedUrl, $title, $snippet, $crawlDate, $mimeType, $level = 1) {
$this->absoluteUrl = $absoluteUrl;
$this->shortUrl = substr($absoluteUrl, 0, 80) . (strlen($absoluteUrl) > 80 ? '...' : '');
$this->encodedUrl = $encodedUrl;
$this->title = $title;
$this->snippet = $snippet;
$this->crawlDate = $crawlDate;
$this->mimeType = $mimeType;
$this->level = $level;
}
/**
* Adds meta.
*
* @param string $name
* Name.
* @param string $value
* Value.
*
* @return $this
*/
public function addMeta($name, $value) {
$this->meta[$name] = $value;
return $this;
}
/**
* Gets value of absoluteUrl.
*
* @return string
* Value of absoluteUrl
*/
public function getAbsoluteUrl() {
return $this->absoluteUrl;
}
/**
* Gets value of encodedUrl.
*
* @return string
* Value of encodedUrl
*/
public function getEncodedUrl() {
return $this->encodedUrl;
}
/**
* Gets value of shortUrl.
*
* @return string
* Value of shortUrl
*/
public function getShortUrl() {
return $this->shortUrl;
}
/**
* Gets value of title.
*
* @return string
* Value of title
*/
public function getTitle() {
return Markup::create(Xss::filter($this->title, [
'b',
'i',
]));
}
/**
* Gets value of snippet.
*
* @return string
* Value of snippet
*/
public function getSnippet() {
return Markup::create(Xss::filter($this->snippet, [
'b',
'i',
]));
}
/**
* Gets value of crawlDate.
*
* @return string
* Value of crawlDate
*/
public function getCrawlDate() {
return $this->crawlDate;
}
/**
* Gets value of meta.
*
* @return \string[]
* Value of meta
*/
public function getMeta() {
return $this->meta;
}
/**
* Gets value of mimeType.
*
* @return string
* Value of mimeType
*/
public function getMimeType() {
return $this->mimeType;
}
/**
* Gets value of level.
*
* @return int
* Value of level
*/
public function getLevel() {
return $this->level;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Result:: |
protected | property | Absolute URL. | |
Result:: |
protected | property | Crawl Date. | |
Result:: |
protected | property | Encoded URL. | |
Result:: |
protected | property | Level. | |
Result:: |
protected | property | Array of meta values keyed by name. | |
Result:: |
protected | property | Mime Type. | |
Result:: |
protected | property | Short URL. | |
Result:: |
protected | property | Snippet. | |
Result:: |
protected | property | Title. | |
Result:: |
public | function | Adds meta. | |
Result:: |
public | function | Gets value of absoluteUrl. | |
Result:: |
public | function | Gets value of crawlDate. | |
Result:: |
public | function | Gets value of encodedUrl. | |
Result:: |
public | function | Gets value of level. | |
Result:: |
public | function | Gets value of meta. | |
Result:: |
public | function | Gets value of mimeType. | |
Result:: |
public | function | Gets value of shortUrl. | |
Result:: |
public | function | Gets value of snippet. | |
Result:: |
public | function | Gets value of title. | |
Result:: |
public | function | Constructs a new Result object. |