aboutsummaryrefslogtreecommitdiff
path: root/src/Search/FTSNotExpr.php
blob: a4aa2191d8ffe1267d4a345a6e10f42f0e7ae79a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php


namespace Micropoly\Search;


class FTSNotExpr extends AbstractFTSExpr
{
    private AbstractFTSExpr $expr;

    /**
     * FTSNotExpr constructor.
     * @param AbstractFTSExpr $expr
     */
    public function __construct(AbstractFTSExpr $expr)
    {
        $this->expr = $expr;
    }

    protected function fts4Query(): string
    {
        return "-{$this->expr->fts4Query()}";
    }

    public function toString(): string
    {
        return "(FTS-NOT {$this->expr->toString()})";
    }
}