Skip to content

Commit

Permalink
Merge 123d913 into c8d5331
Browse files Browse the repository at this point in the history
  • Loading branch information
jlinn committed May 29, 2013
2 parents c8d5331 + 123d913 commit 3619583
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Elastica/Type/Mapping.php 100644 → 100755
Expand Up @@ -71,6 +71,17 @@ public function setProperties(array $properties)
return $this->setParam('properties', $properties);
}

/**
* Sets the mapping _meta
* @param array $meta metadata
* @return \Elastica\Type\Mapping Mapping object
* @link http://www.elasticsearch.org/guide/reference/mapping/meta.html
*/
public function setMeta(array $meta)
{
return $this->setParam('_meta', $meta);
}

/**
* Returns mapping type
*
Expand Down
15 changes: 15 additions & 0 deletions test/lib/Elastica/Test/Type/MappingTest.php 100644 → 100755
Expand Up @@ -245,4 +245,19 @@ public function testDynamicTemplate()
'Indexing status of the multiname.org not available. Dynamic mapping not fully applied!');
$this->assertEquals('not_analyzed', $newMapping['person']['properties']['multiname']['fields']['org']['index']);
}

public function testSetMeta()
{
$index = $this->_createIndex();
$type = $index->getType('test');
$mapping = new Mapping($type, array(
'firstname' => array('type' => 'string', 'store' => 'yes'),
'lastname' => array('type' => 'string')
));
$mapping->setMeta(array('class' => 'test'));
$type->setMapping($mapping);

$mappingData = $type->getMapping();
$this->assertEquals('test', $mappingData['test']['_meta']['class']);
}
}

0 comments on commit 3619583

Please sign in to comment.