Files
Phraseanet/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/KeyValue/NativeKey.php
Mathieu Darse 713442c7b4 Merge metadata & native key expressions
Do not delegates query building to Key instance anymore.
2015-11-06 10:16:33 +01:00

51 lines
1.0 KiB
PHP

<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\KeyValue;
class NativeKey implements Key
{
const TYPE_DATABASE = 'database';
const TYPE_COLLECTION = 'collection';
const TYPE_MEDIA_TYPE = 'media_type';
const TYPE_RECORD_IDENTIFIER = 'record_identifier';
private $type;
private $key;
public static function database()
{
return new self(self::TYPE_DATABASE, 'databox_name');
}
public static function collection()
{
return new self(self::TYPE_COLLECTION, 'collection_name');
}
public static function mediaType()
{
return new self(self::TYPE_MEDIA_TYPE, 'type');
}
public static function recordIdentifier()
{
return new self(self::TYPE_RECORD_IDENTIFIER, 'record_id');
}
private function __construct($type, $key)
{
$this->type = $type;
$this->key = $key;
}
public function getIndexField()
{
return $this->key;
}
public function __toString()
{
return $this->type;
}
}