2018-07-29 16:11:48 +02:00
|
|
|
exports.get_search_terms = function (input) {
|
2019-11-02 00:06:25 +01:00
|
|
|
const search_terms = input.toLowerCase().split(",").map(function (s) {
|
2018-07-29 16:11:48 +02:00
|
|
|
return s.trim();
|
|
|
|
});
|
|
|
|
return search_terms;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.vanilla_match = function (opts) {
|
|
|
|
/*
|
|
|
|
This is a pretty vanilla search criteria
|
|
|
|
where we see if any of our search terms
|
|
|
|
is in our value. When in doubt we should use
|
|
|
|
this for all Zulip filters, but we may
|
|
|
|
have more complicated use cases in some
|
|
|
|
places.
|
|
|
|
|
|
|
|
This is case insensitive.
|
|
|
|
*/
|
2019-11-02 00:06:25 +01:00
|
|
|
const val = opts.val.toLowerCase();
|
2020-02-08 04:08:04 +01:00
|
|
|
return opts.search_terms.some(term => val.includes(term));
|
2018-07-29 16:11:48 +02:00
|
|
|
};
|
|
|
|
|
2019-10-25 09:45:13 +02:00
|
|
|
window.search_util = exports;
|