class SearchQuery in Google Search Appliance 8
Defines a value object for creating a search.
Hierarchy
- class \Drupal\google_appliance\SearchResults\SearchQuery
Expanded class hierarchy of SearchQuery
4 files declare their use of SearchQuery
- Search.php in src/
Service/ Search.php - SearchInterface.php in src/
Service/ SearchInterface.php - SearchViewController.php in src/
Controller/ SearchViewController.php - TestSearch.php in tests/
modules/ google_appliance_test/ src/ TestSearch.php
File
- src/
SearchResults/ SearchQuery.php, line 8
Namespace
Drupal\google_appliance\SearchResultsView source
class SearchQuery {
const ORDER_DATE = 'date:D:S:d1';
const ORDER_REL = 'rel';
/**
* Search string.
*
* @var string
*/
protected $searchQuery;
/**
* Page number.
*
* @var int
*/
protected $page;
/**
* Sort order.
*
* @var string
*/
protected $sort;
/**
* Array of languages.
*
* @var array
*/
protected $languages;
/**
* Constructs a new SearchQuery object.
*
* @param string $searchQuery
* Search terms.
* @param string|null $sort
* Sort field. Pass 'date' for date search. Defaults to rel.
* @param int $page
* Results page.
* @param array $languages
* Array of language codes.
*/
public function __construct($searchQuery, $sort = self::ORDER_REL, $page = 0, array $languages = []) {
$this->searchQuery = $searchQuery;
$this->sort = $sort;
$this->page = $page;
$this->languages = $languages;
}
/**
* Gets value of searchQuery.
*
* @return string
* Value of searchQuery
*/
public function getSearchQuery() {
return $this->searchQuery;
}
/**
* Gets value of page.
*
* @return int
* Value of page
*/
public function getPage() {
return $this->page;
}
/**
* Gets value of sort.
*
* @return string
* Value of sort
*/
public function getSort() {
return $this->sort;
}
/**
* Gets value of languages.
*
* @return array
* Value of languages
*/
public function getLanguages() {
// @todo port _google_appliance_get_lr here?
return $this->languages;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SearchQuery:: |
protected | property | Array of languages. | |
SearchQuery:: |
protected | property | Page number. | |
SearchQuery:: |
protected | property | Search string. | |
SearchQuery:: |
protected | property | Sort order. | |
SearchQuery:: |
public | function | Gets value of languages. | |
SearchQuery:: |
public | function | Gets value of page. | |
SearchQuery:: |
public | function | Gets value of searchQuery. | |
SearchQuery:: |
public | function | Gets value of sort. | |
SearchQuery:: |
constant | |||
SearchQuery:: |
constant | |||
SearchQuery:: |
public | function | Constructs a new SearchQuery object. |