Esempio n. 1
0
 /**
  * @group functional
  */
 public function testFromImage()
 {
     $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->setFieldImage($field, BASE_PATH . '/data/test.jpg');
     $resultSet = $index->search($query);
     $this->assertEquals(3, $resultSet->count());
 }
Esempio n. 2
0
 /**
  * @group functional
  */
 public function testFromImage()
 {
     $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->setFieldImage($field, BASE_PATH . '/data/test.jpg');
     $resultSet = $index->search($query);
     $this->assertEquals(3, $resultSet->count());
 }