Example #1
0
 /**
  * @group functional
  */
 public function testFromReference()
 {
     $field = 'image';
     $client = $this->_getClient();
     $index = $client->getIndex('test');
     $index->create(array(), true);
     $type = $index->getType('test');
     $mapping = new Mapping($type, array($field => array('type' => 'image', 'store' => false, 'include_in_all' => false, 'feature' => array('CEDD' => array('hash' => 'BIT_SAMPLING')))));
     $type->setMapping($mapping);
     $type->addDocuments(array(new Document(1, array($field => $this->_testFileContent)), new Document(2, array($field => $this->_testFileContent)), new Document(3, array($field => $this->_testFileContent))));
     $index->refresh();
     $query = new Image();
     $query->setFieldFeature($field, 'CEDD');
     $query->setFieldHash($field, 'BIT_SAMPLING');
     $query->setFieldBoost($field, 100);
     $query->setImageByReference($field, $index->getName(), $type->getName(), 1);
     $resultSet = $index->search($query);
     $this->assertEquals(3, $resultSet->count());
 }
Example #2
0
 /**
  * @group functional
  */
 public function testFromReference()
 {
     $this->markTestSkipped('Tests skipped as plugin not working properly with ES 1.6.0. See https://github.com/ruflin/Elastica/pull/881');
     $field = 'image';
     $client = $this->_getClient();
     $index = $client->getIndex('test');
     $index->create(array(), true);
     $type = $index->getType('test');
     $mapping = new Mapping($type, array($field => array('type' => 'image', 'store' => false, 'include_in_all' => false, 'feature' => array('CEDD' => array('hash' => 'BIT_SAMPLING')))));
     $type->setMapping($mapping);
     $type->addDocuments(array(new Document(1, array($field => $this->_testFileContent)), new Document(2, array($field => $this->_testFileContent)), new Document(3, array($field => $this->_testFileContent))));
     $index->refresh();
     $query = new Image();
     $query->setFieldFeature($field, 'CEDD');
     $query->setFieldHash($field, 'BIT_SAMPLING');
     $query->setFieldBoost($field, 100);
     $query->setImageByReference($field, $index->getName(), $type->getName(), 1);
     $resultSet = $index->search($query);
     $this->assertEquals(3, $resultSet->count());
 }