PHRAS-676 #time 3h

new : returns facet on "type" (image, video, ...)
new : query on pseudo-field "type", ex:  "type:image"
This commit is contained in:
Jean-Yves Gaulier
2015-09-04 14:34:25 +02:00
parent 2643d697c2
commit e8f61a443b
7 changed files with 530 additions and 472 deletions

View File

@@ -88,6 +88,9 @@ class QueryVisitor implements Visit
case NodeTypes::COLLECTION:
return $this->visitCollectionNode($element);
case NodeTypes::TYPE:
return $this->visitTypeNode($element);
case NodeTypes::IDENTIFIER:
return $this->visitIdentifierNode($element);
@@ -279,6 +282,16 @@ class QueryVisitor implements Visit
return new AST\CollectionExpression($collectionName);
}
private function visitTypeNode(Element $element)
{
if ($element->getChildrenNumber() !== 1) {
throw new \Exception('Type filter can only have a single child.');
}
$typeName = $element->getChild(0)->getValue()['value'];
return new AST\TypeExpression($typeName);
}
private function visitIdentifierNode(Element $element)
{
if ($element->getChildrenNumber() !== 1) {