2018-07-29 16:11:48 +02:00
|
|
|
exports.get_search_terms = function (input) {
|
2020-07-15 00:34:28 +02:00
|
|
|
const search_terms = input
|
|
|
|
.toLowerCase()
|
|
|
|
.split(",")
|
|
|
|
.map((s) => s.trim());
|
2018-07-29 16:11:48 +02:00
|
|
|
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-07-02 01:39:34 +02: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;
|