From d45f40bfab6f069f7f381e51638fb66db76e2987 Mon Sep 17 00:00:00 2001 From: mikeoscar2006 <89641725+mikeoscar2006@users.noreply.github.com> Date: Sun, 2 Oct 2022 22:35:22 +0530 Subject: [PATCH] webui: add OR filter in table search. resolves #13619 (#13621) Co-authored-by: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com> --- src/Jackett.Common/Content/custom.js | 4 ++-- src/Jackett.Common/Content/index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Jackett.Common/Content/custom.js b/src/Jackett.Common/Content/custom.js index d7a5b7e30..753a23f0c 100644 --- a/src/Jackett.Common/Content/custom.js +++ b/src/Jackett.Common/Content/custom.js @@ -1319,7 +1319,7 @@ function updateSearchResultTable(element, results) { var newInputSearch = inputSearch.clone(); newInputSearch.attr("custom", "true"); newInputSearch.attr("data-toggle", "tooltip"); - newInputSearch.attr("title", "Search query consists of several keywords.\nKeyword starting with \"-\" is considered a negative match."); + newInputSearch.attr("title", "Search query consists of several keywords.\nKeyword starting with \"-\" is considered a negative match.\nKeywords separated by \"|\" are considered as OR filters."); newInputSearch.on("input", function () { var newKeywords = []; var filterTextKeywords = $(this).val().split(" "); @@ -1332,7 +1332,7 @@ function updateSearchResultTable(element, results) { else if (keyword.startsWith("-")) newKeyword = "^((?!" + $.fn.dataTable.util.escapeRegex(keyword.substring(1)) + ").)*$"; else - newKeyword = $.fn.dataTable.util.escapeRegex(keyword); + newKeyword = '(' + keyword.split('|').map(k => $.fn.dataTable.util.escapeRegex(k)).join('|') + ')'; newKeywords.push(newKeyword); }); var filterText = newKeywords.join(" "); diff --git a/src/Jackett.Common/Content/index.html b/src/Jackett.Common/Content/index.html index e9f2f6e6b..81d9a28da 100644 --- a/src/Jackett.Common/Content/index.html +++ b/src/Jackett.Common/Content/index.html @@ -754,6 +754,6 @@ - +