当前位置: 首页>>代码示例>>PHP>>正文


PHP Mapping::setProperties方法代码示例

本文整理汇总了PHP中Elastica\Type\Mapping::setProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Mapping::setProperties方法的具体用法?PHP Mapping::setProperties怎么用?PHP Mapping::setProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Elastica\Type\Mapping的用法示例。


在下文中一共展示了Mapping::setProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getElasticaMapping

 /**
  * @return \Elastica\Type\Mapping
  */
 public function getElasticaMapping()
 {
     $mapping = new Mapping();
     $mapping->setProperties($this->getElasticaFields());
     $mapping->setParam('date_detection', false);
     return $mapping;
 }
开发者ID:ajshort,项目名称:silverstripe-elastica,代码行数:10,代码来源:Searchable.php

示例2: updateElasticsearchMapping

 /**
  * Add a mapping for the location of the photograph
  */
 public function updateElasticsearchMapping(\Elastica\Type\Mapping $mapping)
 {
     // get the properties of the individual fields as an array
     $properties = $mapping->getProperties();
     // enable tags to be faceted
     $properties['RawValue'] = array('type' => 'string', 'index' => 'not_analyzed');
     // set the new properties on the mapping
     $mapping->setProperties($properties);
     return $mapping;
 }
开发者ID:gordonbanderson,项目名称:flickr-editor,代码行数:13,代码来源:FlickrTagElasticaIndexingExtension.php

示例3: _getIndexForTest

 protected function _getIndexForTest()
 {
     $index = $this->_createIndex();
     $mapping = new Mapping();
     $mapping->setProperties(array('comments' => array('type' => 'nested', 'properties' => array('name' => array('type' => 'string'), 'body' => array('type' => 'string')))));
     $type = $index->getType('test');
     $type->setMapping($mapping);
     $type->addDocuments(array(new Document(1, array('comments' => array(array('name' => 'bob', 'body' => 'this is bobs comment'), array('name' => 'john', 'body' => 'this is johns comment')), 'tags' => array('foo', 'bar'))), new Document(2, array('comments' => array(array('name' => 'bob', 'body' => 'this is another comment from bob'), array('name' => 'susan', 'body' => 'this is susans comment')), 'tags' => array('foo', 'baz')))));
     $index->refresh();
     return $index;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:11,代码来源:ReverseNestedTest.php

示例4: _getIndexForTest

 protected function _getIndexForTest()
 {
     $index = $this->_createIndex('elastica_test_filter_nested');
     $type = $index->getType('user');
     $mapping = new Mapping();
     $mapping->setProperties(array('firstname' => array('type' => 'string', 'store' => 'yes'), 'lastname' => array('type' => 'string'), 'hobbies' => array('type' => 'nested', 'include_in_parent' => true, 'properties' => array('hobby' => array('type' => 'string')))));
     $type->setMapping($mapping);
     $response = $type->addDocuments(array(new Document(1, array('firstname' => 'Nicolas', 'lastname' => 'Ruflin', 'hobbies' => array(array('hobby' => 'opensource')))), new Document(2, array('firstname' => 'Nicolas', 'lastname' => 'Ippolito', 'hobbies' => array(array('hobby' => 'opensource'), array('hobby' => 'guitar'))))));
     $index->refresh();
     return $index;
 }
开发者ID:makeandship,项目名称:wordpress-fantastic-elasticsearch,代码行数:11,代码来源:NestedTest.php

示例5: postInstall

 public function postInstall(RecordInterface $record)
 {
     $client = new Client(array('host' => $this->registry['search.host'], 'port' => $this->registry['search.port']));
     $index = $client->getIndex('amun');
     $index->create();
     $type = $index->getType('page');
     $mapping = new Mapping();
     $mapping->setType($type);
     $mapping->setProperties(array('id' => array('type' => 'string', 'include_in_all' => false), 'userId' => array('type' => 'integer', 'include_in_all' => false), 'path' => array('type' => 'string', 'include_in_all' => true), 'title' => array('type' => 'string', 'include_in_all' => true), 'content' => array('type' => 'string', 'include_in_all' => true), 'date' => array('type' => 'date', 'include_in_all' => false)));
     $mapping->send();
 }
开发者ID:visapi,项目名称:amun,代码行数:11,代码来源:Setup.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("geohash_grid");
     $mapping = new Mapping();
     $mapping->setProperties(array("location" => array("type" => "geo_point")));
     $type = $this->_index->getType("test");
     $type->setMapping($mapping);
     $docs = array(new Document("1", array("location" => array("lat" => 32.849437, "lon" => -117.271732))), new Document("2", array("location" => array("lat" => 32.79832, "lon" => -117.246648))), new Document("3", array("location" => array("lat" => 37.782439, "lon" => -122.39256))));
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:12,代码来源:GeohashGridTest.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("nested");
     $mapping = new Mapping();
     $mapping->setProperties(array("resellers" => array("type" => "nested", "properties" => array("name" => array("type" => "string"), "price" => array("type" => "double")))));
     $type = $this->_index->getType("test");
     $type->setMapping($mapping);
     $docs = array(new Document("1", array("resellers" => array("name" => "spacely sprockets", "price" => 5.55))), new Document("1", array("resellers" => array("name" => "cogswell cogs", "price" => 4.98))));
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:12,代码来源:NestedTest.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("ip_range");
     $mapping = new Mapping();
     $mapping->setProperties(array("address" => array("type" => "ip")));
     $type = $this->_index->getType("test");
     $type->setMapping($mapping);
     $docs = array(new Document("1", array("address" => "192.168.1.100")), new Document("2", array("address" => "192.168.1.150")), new Document("3", array("address" => "192.168.1.200")));
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:12,代码来源:IpRangeTest.php

示例9: getType

 /**
  * @return Type
  */
 private function getType()
 {
     if (null === $this->type) {
         $this->type = $this->getIndex()->getType($this->typeName);
         $mapping = new Type\Mapping();
         $mapping->setType($this->type);
         $mapping->setTtl(['enabled' => true]);
         $mapping->setProperties([self::ID_FIELD => ['type' => 'string', 'include_in_all' => true], self::VALUE_FIELD => ['type' => 'string', 'include_in_all' => true]]);
         $mapping->send();
     }
     return $this->type;
 }
开发者ID:basster,项目名称:doctrine-elastica-cache,代码行数:15,代码来源:Cache.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("nested");
     $mapping = new Mapping();
     $mapping->setProperties(array("comments" => array("type" => "nested", "properties" => array("name" => array("type" => "string"), "body" => array("type" => "string")))));
     $type = $this->_index->getType("test");
     $type->setMapping($mapping);
     $docs = array(new Document("1", array("comments" => array(array("name" => "bob", "body" => "this is bobs comment"), array("name" => "john", "body" => "this is johns comment")), "tags" => array("foo", "bar"))), new Document("2", array("comments" => array(array("name" => "bob", "body" => "this is another comment from bob"), array("name" => "susan", "body" => "this is susans comment")), "tags" => array("foo", "baz"))));
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:12,代码来源:ReverseNestedTest.php

示例11: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("date_histogram");
     $mapping = new Mapping();
     $mapping->setProperties(array("created" => array("type" => "date")));
     $type = $this->_index->getType("test");
     $type->setMapping($mapping);
     $docs = array(new Document("1", array("created" => 1390962135000)), new Document("2", array("created" => 1390965735000)), new Document("3", array("created" => 1390954935000)));
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:12,代码来源:DateHistogramTest.php

示例12: __construct

 /**
  * Creates a new Client of Elastica with the parameters $host and $port, And receive the index and type of stored data
  *
  * @param $user User Entity, $host string, $port string, $index string, $type string
  */
 public function __construct(User $user, $host, $port, $index, $type)
 {
     $this->user = $user;
     $this->client = new Client(array('host' => $host, 'port' => $port));
     $this->index = $this->client->getIndex($index);
     if (!$this->index->exists()) {
         $this->index->create();
         $this->index->refresh();
     }
     $this->type = $this->index->getType($type);
     $mapping = new Mapping();
     $mapping->setType($this->type);
     $mapping->setProperties(array('name' => array('type' => 'string'), 'email' => array('type' => 'string'), 'password' => array('type' => 'string')));
 }
开发者ID:ahmetakbn,项目名称:ElasticaClientUserBundle,代码行数:19,代码来源:ElasticaUserService.php

示例13: updateElasticsearchMapping

 /**
  * Add a mapping for the location of the photograph
  */
 public function updateElasticsearchMapping(\Elastica\Type\Mapping $mapping)
 {
     // get the properties of the individual fields as an array
     $properties = $mapping->getProperties();
     // add a location with geo point
     $precision1cm = array('format' => 'compressed', 'precision' => '1cm');
     $properties['location'] = array('type' => 'geo_point', 'fielddata' => $precision1cm);
     $properties['ShutterSpeed'] = array('type' => 'string', 'index' => 'not_analyzed');
     $properties['Aperture'] = array('type' => 'double');
     // by default casted as a string, we want a date 2015-07-25 18:15:33 y-M-d H:m:s
     $properties['TakenAt'] = array('type' => 'date', 'format' => 'y-M-d H:m:s');
     // set the new properties on the mapping
     $mapping->setProperties($properties);
     return $mapping;
 }
开发者ID:gordonbanderson,项目名称:flickr-editor,代码行数:18,代码来源:FlickrPhotoElasticaIndexingExtension.php

示例14: create

 /**
  * Create the mapping for the type.
  *
  * @param \Cake\Datasource\ConnectionInterface $db The Elasticsearch connection
  * @return void
  */
 public function create(ConnectionInterface $db)
 {
     if (empty($this->schema)) {
         return;
     }
     $index = $db->getIndex();
     if (!$index->exists()) {
         $index->create();
     }
     $type = $index->getType($this->table);
     $mapping = new ElasticaMapping();
     $mapping->setType($type);
     $mapping->setProperties($this->schema);
     $mapping->send();
     $this->created[] = $db->configName();
 }
开发者ID:edukondaluetg,项目名称:elastic-search,代码行数:22,代码来源:TestFixture.php

示例15: setUp

 public function setUp()
 {
     $client = $this->_getClient();
     $index = $client->getIndex('elastica_test_filter_nested_abstract_filter');
     $index->create(array(), true);
     $type = $index->getType('user');
     $mapping = new Mapping();
     $mapping->setProperties(array('firstname' => array('type' => 'string', 'store' => 'yes'), 'lastname' => array('type' => 'string'), 'hobbies' => array('type' => 'nested', 'include_in_parent' => true, 'properties' => array('hobby' => array('type' => 'string')))));
     $type->setMapping($mapping);
     // Adds a list of documents with _bulk upload to the index
     $docs = array();
     $docs[] = new Document(1, array('firstname' => 'Nicolas', 'lastname' => 'Ruflin', 'hobbies' => array(array('hobby' => 'opensource'))));
     $docs[] = new Document(2, array('firstname' => 'Nicolas', 'lastname' => 'Ippolito', 'hobbies' => array(array('hobby' => 'opensource'), array('hobby' => 'guitar'))));
     $response = $type->addDocuments($docs);
     // Refresh index
     $index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:17,代码来源:NestedFilterWithSetFilterTest.php


注:本文中的Elastica\Type\Mapping::setProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。