Update PoC parser with AST

This commit is contained in:
Mathieu Darse
2014-08-18 11:53:05 +02:00
parent 1fbddfec3e
commit 12a757978f
10 changed files with 523 additions and 142 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
class TextNode extends Node
{
protected $text;
public function __construct($text)
{
$this->text = $text;
}
public function getQuery($field = '_all')
{
return array(
'match' => array(
$field => $this->text
)
);
}
public function __toString()
{
return sprintf('"%s"', $this->text);
}
}