Comment out snippet highlighting in search function; add whitespace for clarity in index_files function
This commit is contained in:
parent
9e70543654
commit
653d7e0b6e
2 changed files with 7 additions and 5 deletions
|
@ -20,7 +20,7 @@ from markdown_it import MarkdownIt
|
|||
from functools import lru_cache
|
||||
from threading import Lock
|
||||
# Application version
|
||||
APP_VERSION = "0.0.10 (2025 Apr 6th)"
|
||||
APP_VERSION = "0.0.11 (2025 Apr 7th)"
|
||||
|
||||
# Configuration constants
|
||||
ITEMS_PER_PAGE = int(os.environ.get("ITEMS_PER_PAGE", 50)) # Default items per page
|
||||
|
@ -339,7 +339,7 @@ def search():
|
|||
start = max(0, exact_pos - snippet_char_limit//2)
|
||||
end = min(len(content), exact_pos + len(query) + snippet_char_limit//2)
|
||||
snippet = content[start:end]
|
||||
snippet = snippet.replace(query, f"**{query}**")
|
||||
#snippet = snippet.replace(query, f"**{query}**")
|
||||
return snippet
|
||||
|
||||
# Try all words in any order
|
||||
|
@ -380,8 +380,8 @@ def search():
|
|||
|
||||
if max_words > 0:
|
||||
snippet = content[best_start:best_end]
|
||||
for word in words:
|
||||
snippet = snippet.replace(word, f"**{word}**")
|
||||
#for word in words:
|
||||
# snippet = snippet.replace(word, f"**{word}**")
|
||||
return snippet
|
||||
|
||||
# Recursively try with fewer words
|
||||
|
@ -400,7 +400,8 @@ def search():
|
|||
if word_pos != -1:
|
||||
start = max(0, word_pos - snippet_char_limit//2)
|
||||
end = min(len(content), word_pos + len(word) + snippet_char_limit//2)
|
||||
return content[start:end].replace(word, f"**{word}**")
|
||||
#return content[start:end].replace(word, f"**{word}**")
|
||||
return content[start:end]
|
||||
|
||||
return "No snippet found"
|
||||
except Exception as e:
|
||||
|
|
|
@ -501,6 +501,7 @@ def index_files(directory):
|
|||
for i in range(0, len(files_to_index), batch_size):
|
||||
batch = files_to_index[i:i + batch_size]
|
||||
|
||||
|
||||
# Process current batch
|
||||
results = pool.map(index_single_file, batch, chunksize=chunksize)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue