mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Handle search with on timestamp
PHRAS-689
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user