Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Filtertext #351

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/Builders/FilterBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,44 @@ public function where($field, $value)
return $this;
}

/**
* Exclude results containing text
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these comments since it's redundant

* 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*
* @param string $field
* @param array $value
* @return $this
*/
public function whereNotInText($field, $value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it can be renamed to whereNotMatchPhrase to be more specific on which query is made. What your thoughts?

{
$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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove this method? It was added and merged in PR #355

{
$this->wheres['must'][] = [
'match' => [
$field => $value,
]
];
return $this;
}

/**
* Add a whereIn condition.
*
Expand Down