From 13bec2a015a17b8bfa2d0b46be4b5462b5756d96 Mon Sep 17 00:00:00 2001 From: Daniel Kantor Date: Wed, 9 Aug 2023 19:27:12 +0200 Subject: [PATCH] perf: limit number of regex results per file --- seagoat/sources/ripgrep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seagoat/sources/ripgrep.py b/seagoat/sources/ripgrep.py index fd6af89e..c6f3379d 100644 --- a/seagoat/sources/ripgrep.py +++ b/seagoat/sources/ripgrep.py @@ -14,7 +14,7 @@ def _fetch(query_text: str, path: str, limit: int): query_text = re.sub(r"\s+", "|", query_text) files = {} - for result in Ripgrepy(query_text, path).json().run().as_dict: + for result in Ripgrepy(query_text, path).max_count(limit).json().run().as_dict: result_data = result["data"] absolute_path = result_data["path"]["text"] relative_path = Path(absolute_path).relative_to(path)