Handle search with on timestamp

PHRAS-689
This commit is contained in:
Mathieu Darse
2015-11-10 18:36:29 +01:00
parent 5dc1fbe2cb
commit 0cd9933ac6
7 changed files with 92 additions and 6 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\KeyValue;
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
class TimestampKey implements Key
{
private $type;
private $index_field;
public static function createdOn()
{
return new self('creation', 'created_on');
}
public static function updatedOn()
{
return new self('update', 'updated_on');
}
private function __construct($type, $index_field)
{
$this->type = $type;
$this->index_field = $index_field;
}
public function getIndexField(QueryContext $context, $raw = false)
{
return $this->index_field;
}
public function isValueCompatible($value, QueryContext $context)
{
return true;
}
public function __toString()
{
return $this->type;
}
}