当前位置: 首页>>代码示例>>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;未经允许,请勿转载。