From 96d044941debdc71580f2bb6230c9a6a2beaac68 Mon Sep 17 00:00:00 2001
From: Hadi <112569860+anotherhadi@users.noreply.github.com>
Date: Thu, 25 Sep 2025 15:41:27 +0200
Subject: [PATCH] Check if the result limit has been hit
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
---
back/api/api.go | 2 --
back/search/dataleak/dataleak.go | 5 +++++
front/src/lib/types.ts | 1 +
front/src/routes/search/[id]/index.svelte | 9 +++++++++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/back/api/api.go b/back/api/api.go
index 5cc0f62..754e3c8 100644
--- a/back/api/api.go
+++ b/back/api/api.go
@@ -10,8 +10,6 @@ import (
"github.com/gin-gonic/gin"
)
-// TODO: We need to know when we hit the LIMIT
-
func routes(s *server.Server, cache *map[string]*search.Result) {
s.Router.Use(
func(c *gin.Context) {
diff --git a/back/search/dataleak/dataleak.go b/back/search/dataleak/dataleak.go
index 4632474..d48212c 100644
--- a/back/search/dataleak/dataleak.go
+++ b/back/search/dataleak/dataleak.go
@@ -15,6 +15,7 @@ type LeakResult struct {
Duration time.Duration
Rows []map[string]string
Error string
+ LimitHit bool // Whether the search hit the limit
}
func Search(s *server.Server, queryText, column string, exactMatch bool) LeakResult {
@@ -76,6 +77,10 @@ func Search(s *server.Server, queryText, column string, exactMatch bool) LeakRes
return result
}
+ if len(result.Rows) >= s.Settings.Limit {
+ result.LimitHit = true
+ }
+
result.Rows = removeDuplicateMaps(result.Rows)
result.Duration = time.Since(now)
diff --git a/front/src/lib/types.ts b/front/src/lib/types.ts
index 7344dfd..5c1dccd 100644
--- a/front/src/lib/types.ts
+++ b/front/src/lib/types.ts
@@ -8,6 +8,7 @@ type LeakResult = {
Duration: number;
Error: string;
Rows: Array