Check type of field before considering it a Date

This commit is contained in:
Benoît Burnichon
2016-01-21 12:21:52 +01:00
parent e884bcff93
commit d0bae320d3

View File

@@ -4,6 +4,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\Search;
use Alchemy\Phrasea\SearchEngine\Elastic\AST;
use Alchemy\Phrasea\SearchEngine\Elastic\Exception\Exception;
use Alchemy\Phrasea\SearchEngine\Elastic\Mapping;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Structure;
use Hoa\Compiler\Llk\TreeNode;
use Hoa\Visitor\Element;
@@ -207,7 +208,7 @@ class QueryVisitor implements Visit
if ($key instanceof AST\KeyValue\TimestampKey) {
return true;
} elseif ($key instanceof AST\KeyValue\FieldKey) {
return $this->structure->get($key->getName()) !== null;
return $this->structure->typeOf($key->getName()) === Mapping::TYPE_DATE;
}
return false;
}