diff --git a/src/Builders/FilterBuilder.php b/src/Builders/FilterBuilder.php index 792378a..d0dc625 100644 --- a/src/Builders/FilterBuilder.php +++ b/src/Builders/FilterBuilder.php @@ -151,6 +151,44 @@ public function where($field, $value) return $this; } + /** + * Exclude results containing text + * Can't use 'term' because it's not analyzed + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query + * + * @param string $field + * @param array $value + * @return $this + */ + public function whereNotInText($field, $value) + { + $this->wheres['must_not'][] = [ + 'match_phrase' => [ + $field => $value + ] + ]; + + return $this; + } + + /** + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html Match query + * + * @param string $field + * @param string $value + * @return $this + */ + public function whereMatch($field, $value) + { + $this->wheres['must'][] = [ + 'match' => [ + $field => $value, + ] + ]; + return $this; + } + /** * Add a whereIn condition. *