mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Update PoC parser with AST
This commit is contained in:
27
lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php
Normal file
27
lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user