From 5dcaa2198dc5e4641fb8b03df36fdcf872461afa Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 15 Oct 2023 11:55:17 +0200 Subject: [PATCH] Add number of matches and possible hint about missing results due to too small N Signed-off-by: DL6ER --- scripts/pi-hole/js/search.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/search.js b/scripts/pi-hole/js/search.js index a88dd030..cbbedd28 100644 --- a/scripts/pi-hole/js/search.js +++ b/scripts/pi-hole/js/search.js @@ -140,7 +140,41 @@ function eventsource(partial) { result += "
"; } - result += "Search took " + (1000 * data.took).toFixed(1) + " ms"; + result += "Number of results per type:
"; + result += + " - " + + data.search.results.domains.exact + + " exact domain matches
"; + result += + " - " + + data.search.results.domains.regex + + " regex domain matches
"; + result += + " - " + + data.search.results.gravity.allow + + " allowlist (antigravity) matches
"; + result += + " - " + + data.search.results.gravity.block + + " blocklist (gravity) matches
"; + + if ( + data.search.results.gravity.allow > data.search.parameters.N || + data.search.results.gravity.block > data.search.parameters.N || + data.search.results.domains.exact > data.search.parameters.N || + data.search.results.domains.regex > data.search.parameters.N + ) { + result += + "

Note: " + + "The number of results to return per type is limited to " + + data.search.parameters.N + + " entries.
There are " + + data.search.results.total + + " matching entries in total.
Consider " + + "using a more specific search term or increase N.
"; + } + + result += "
Search took " + (1000 * data.took).toFixed(1) + " ms"; ta.append(result); })