Skip to content

Commit

Permalink
make new alert searches use OR for keywords
Browse files Browse the repository at this point in the history
Join multiple keywords with OR so any matches rather than having to
match on all.
  • Loading branch information
struan committed Oct 28, 2024
1 parent bcd067c commit 97dfb4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion classes/AlertView/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private function getBasicData() {

$this->data['search_section'] = trim(get_http_var("search_section", $existing_section));

$this->data['keyword'] = implode(' ', $this->data['words']);
$this->data['keyword'] = implode(' OR ', $this->data['words']);
if ($this->data['exclusions']) {
$this->data['keyword'] .= " -" . $this->data["exclusions"];
}
Expand Down
1 change: 1 addition & 0 deletions classes/Utility/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public static function prettifyCriteria($alert_criteria, $as_parts = false) {
$parts = ['words' => [], 'sections' => [], 'exclusions' => []];
if ($alert_criteria) {
# check for phrases
$alert_criteria = str_replace(' OR ', ' ', $alert_criteria);
if (strpos($alert_criteria, '"') !== false) {
# match phrases
preg_match_all('/"([^"]*)"/', $alert_criteria, $phrases);
Expand Down

0 comments on commit 97dfb4c

Please sign in to comment.