From db19a779a1b38cde72f065123c38aa2176f86d66 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 9 Feb 2026 18:00:38 -0300 Subject: [PATCH] Fix case-sensitive search in PDF term matching The previous implementation used case-sensitive string matching, which could miss valid matches when the case differed between the search term and the PDF content. This is particularly problematic for legal citations which may appear in various case formats (e.g., 'F.3d' vs 'f.3d', 'Singh-Kaur' vs 'singh-kaur'). This commit makes the search case-insensitive by converting both the search term and the extracted text to lowercase before comparison, ensuring all valid matches are found regardless of case. --- check_pdf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_pdf.py b/check_pdf.py index 2378fa18..a18effd5 100644 --- a/check_pdf.py +++ b/check_pdf.py @@ -12,12 +12,12 @@ def search_pdf(pdf_path, search_terms): text = reader.pages[page_num].extract_text() for term in search_terms: - if term in text: + if term.lower() in text.lower(): print(f"\nFound '{term}' on page {page_num + 1}") print("-" * 80) # Show some context around the match - pos = text.find(term) + pos = text.lower().find(term.lower()) start = max(0, pos - 100) end = min(len(text), pos + len(term) + 100)