本文整理匯總了PHP中Indexer::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP Indexer::add方法的具體用法?PHP Indexer::add怎麽用?PHP Indexer::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Indexer
的用法示例。
在下文中一共展示了Indexer::add方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
SELECT
announcement.item_id AS item_id,
announcement.item_id AS index_id,
NULL AS version_id,
announcement.modification_date,
CONCAT(announcement.title, " ", announcement.description, " ", user.firstname, " ", user.lastname) AS search_data
FROM
announcement
LEFT JOIN
user
ON
user.item_id = announcement.creator_id
WHERE
announcement.deletion_date IS NULL
';
$indexer->add(CS_ANNOUNCEMENT_TYPE, $query);
////////////////////////////
////// Sections ////////////
////////////////////////////
$query = '
SELECT
section.item_id AS item_id,
section.material_item_id AS index_id,
section.version_id AS version_id,
section.modification_date,
CONCAT(section.title, " ", section.description, " ", user.firstname, " ", user.lastname) AS search_data
FROM
section
LEFT JOIN
user
示例2: Indexer
<?php
require "elastic.php";
require "indexer.php";
require "searcher.php";
$indexer = new Indexer();
$indexer->setIndex("test")->setType("type");
echo "Add\n";
print_r($indexer->add(array("name" => 'asd', "phone" => "79111234567")));
print_r($indexer->add(array("name" => 'test asd', "phone" => "79133234567")));
print_r($indexer->add(array("name" => 'test', "phone" => "79155234567")));
$client = new Elastic();
echo "Get\n";
print_r($client->get(array('index' => 'test', 'type' => 'type', 'id' => 1)));
$searcher = new Searcher();
$searcher->setIndex("test")->setType("type");
echo "Search\n";
print_r($searcher->partial_query(array("name" => "te", 'phone' => '7913')));
// print_r($searcher->query_string('test +79155234*'));
echo "Clear index\n";
//print_r($indexer->clear());