本文整理汇总了PHP中Search::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::getQuery方法的具体用法?PHP Search::getQuery怎么用?PHP Search::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::getQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rewind
/**
* Start the initial scan search
* @link http://php.net/manual/en/iterator.rewind.php
* @throws \Elastica\Exception\InvalidException
*
* @return void
*/
public function rewind()
{
$this->_search->getQuery()->setSize($this->sizePerShard);
$this->_search->setOption(Search::OPTION_SEARCH_TYPE, Search::OPTION_SEARCH_TYPE_SCAN);
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
// initial scan request
$this->_setScrollId($this->_search->search());
// trigger first scroll request
$this->_scroll();
}
示例2: Page
* ----------------------------------------------
*/
session_start();
require "blocks/autoload.php";
require "blocks/db.php";
require "blocks/user.php";
$page = new Page("search", $db);
try {
$page->getPageSettings();
} catch (DataException $e) {
die(require "blocks/errorTemplate.php");
}
$search = new Search($db);
$search->query = $_GET['keywords'];
try {
$search->getQuery();
} catch (DataException $e) {
die(require "blocks/errorTemplate.php");
}
$item = new Item();
Item::setDataArray($search->resultArr, $db);
$searchResultArr = Item::$dataArray;
$item->dataCount = count($searchResultArr);
$pageData = $item->getPageData();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="<? echo $page->meta_d; ?>">
<meta name="keywords" content="<? echo $page->meta_k; ?>">
示例3:
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<?php
}
?>
<!-- // Records that Match Query -->
<?php
if ($s->foundSearchResults()) {
?>
<h3><?php
echo $s->getQuery();
?>
</h3>
<ul class="covers">
<!-- // Loop through list from db -->
<?php
for ($i = 0; $i < sizeof($recordList); $i++) {
?>
<li>
<a class="overlay" data-toggle="modal" href="view/record.php?id=<?php
echo $recordList[$i]['record_id'];
?>
" data-target="#recordModal">
<div class="cover">
<img src="<?php
echo WEB::_image($recordList[$i]['record_artwork']);
示例4: applyLimit
/**
* @param Search $search
* @param int|null $limit
*/
protected function applyLimit(Search $search, $limit)
{
if ($limit > 0) {
$search->getQuery()->take($limit);
}
}