-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing PlainToTsquery #10
Comments
I also received a similar problem. |
mrVrAlex
assigned mrVrAlex, M-E-M-F-I-S, maxvoronov, dmitrijivanenko and alekseytkachenko
Jul 10, 2018
@allan-simon @nepster-web Please give an example |
It's been a long time so I don't remember very well , but basically in the code below if you use
(note in the example above i added myself a plain_to_tsquery operator like this 👍 <?php
namespace AppBundle\ORM;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
class PlainToTsquery extends FunctionNode
{
private $lang;
private $text = null;
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->text = $parser->StringExpression(); //SingleValuedPathExpression();
// parse second parameter if available
$lexer = $parser->getLexer();
if(Lexer::T_COMMA === $lexer->lookahead['type']){
$parser->match(Lexer::T_COMMA);
// then actually the first argument was
// the language
$this->lang = $this->text;
$this->text = $parser->StringExpression();
}
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
public function getSql(SqlWalker $sqlWalker)
{
if (is_null($this->lang)) {
return sprintf(
'plainto_tsquery(%s)',
$this->text->dispatch($sqlWalker)
);
}
return sprintf(
'plainto_tsquery(%s::regconfig, %s)',
$this->lang->dispatch($sqlWalker),
$this->text->dispatch($sqlWalker)
);
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
currently with ToTsquery, it fails if you enter a string with a space , without a
and
for this postgresql propose the
plainto_tsquery
which is not supported by this library.The text was updated successfully, but these errors were encountered: