Skip to content

Commit

Permalink
Update filterDocListerabstract (#334)
Browse files Browse the repository at this point in the history
* Update filterDocListerabstract

containsAll: for queries "contains all the listed words"

exam
filter_delimiter = ' '
tv:documentTags:containsAll:"one two more"

* Update filterDocLister.abstract.php
  • Loading branch information
zatomant authored and AgelxNash committed Nov 7, 2018
1 parent f13c2f5 commit 3606d7a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions assets/snippets/DocLister/core/filterDocLister.abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,20 @@ protected function build_sql_where($table_alias, $field, $operator, $value)
$output = '';
}
break;
case 'containsAll':
$words = explode($this->DocLister->getCFGDef('filter_delimiter', ','), $value);
$word_arr = array();
foreach ($words as $word) {
if (($likeWord = $this->DocLister->LikeEscape($output, $word)) !== '') {
$word_arr[] = $likeWord;
}
}
if (!empty($word_arr)) {
$output = '(' . implode(' AND ', $word_arr) . ')';
} else {
$output = '';
}
break;
case 'in':
$output .= ' IN(' . $this->DocLister->sanitarIn($value, ',', true) . ')';
break;
Expand Down

0 comments on commit 3606d7a

Please sign in to comment.