當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Indexer::add方法代碼示例

本文整理匯總了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
開發者ID:a2call,項目名稱:commsy,代碼行數:31,代碼來源:search_index.php

示例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());
開發者ID:andruekonst,項目名稱:Elastic-PHP,代碼行數:21,代碼來源:test.php


注:本文中的Indexer::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。