Skip to content

Commit 55807f9

Browse files
Merge pull request #20 from PFS-AI/DEVELOPMENT
Fix: regex pattern adjustment for classic search #18
2 parents d4401e1 + 5c84949 commit 55807f9

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
LANGCHAIN_TRACING_V2="true"
99
LANGCHAIN_PROJECT="Precision-File-Search"
1010
LANGCHAIN_API_KEY="lsv2_"
11+
12+
# Fore Huggingface Hub Offline Mode
13+
HF_HUB_OFFLINE=1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ This guide provides instructions for both regular users (via a simple installer)
153153

154154
The easiest way to install Precision File Search is to download the latest official installer for Windows.
155155

156-
[![Latest Release](https://img.shields.io/badge/Download-V1.1.0-blueviolet?style=for-the-badge)](https://github.com/PFS-AI/PFS/releases/latest)
156+
[![Latest Release](https://img.shields.io/badge/Download-V1.1.1-blueviolet?style=for-the-badge)](https://github.com/PFS-AI/PFS/releases/latest)
157157

158158
1. Click the button above to go to the latest release page.
159159
2. Under the **Assets** section, download the `PFS-SETUP_vX.X.X.exe` file.

backend/config_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def get_user_data_dir() -> str:
116116
},
117117
# Block Version: 1.1.0
118118
"embedding_model": {
119-
"model_name": "sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
119+
"model_name": "sentence-transformers/all-MiniLM-L6-v2",
120120
"device": "auto"
121121
},
122122
"reranker_model": {

backend/file_engine.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,28 @@ def _is_match_content(file_path: Path, pattern: re.Pattern) -> bool:
120120

121121
def _translate_wildcard_to_regex(pattern: str) -> str:
122122
"""
123-
Translates a file system wildcard pattern (*, ?) to a valid regex pattern.
124-
This makes the "Use Regex" feature more intuitive for file searches.
123+
Translates a file system wildcard pattern (*, ?) to a valid regex pattern,
124+
while preserving common regex anchors like ^ and $.
125125
"""
126+
# Preserve anchors and escape the rest of the pattern
127+
has_start_anchor = pattern.startswith('^')
128+
has_end_anchor = pattern.endswith('$')
129+
130+
if has_start_anchor:
131+
pattern = pattern[1:]
132+
if has_end_anchor:
133+
pattern = pattern[:-1]
134+
126135
escaped_pattern = re.escape(pattern)
127136
regex_pattern = escaped_pattern.replace(r'\*', '.*')
128137
regex_pattern = regex_pattern.replace(r'\?', '.')
138+
139+
# Re-apply anchors to the final regex pattern
140+
if has_start_anchor:
141+
regex_pattern = '^' + regex_pattern
142+
if has_end_anchor:
143+
regex_pattern = regex_pattern + '$'
144+
129145
return regex_pattern
130146

131147
# 4. FILE SEARCH ENGINE CLASS ###################################################################################

static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ <h2 class="modal-title"><i class="fas fa-info-circle"></i> <span data-i18n-key="
480480
<a href="https://pfs-ai.github.io/PFS/" target="_blank" rel="noopener noreferrer"><i class="fab fa-github"></i> GitHub</a> |
481481
<a href="/license" target="_blank"><i class="fas fa-file-contract"></i> License</a> |
482482
<span class="footer-item"><i class="fas fa-calendar-alt"></i> 2025</span> |
483-
<span class="footer-item"><i class="fas fa-code-branch"></i> V1.1.0</span>
483+
<span class="footer-item"><i class="fas fa-code-branch"></i> V1.1.1</span>
484484
</div>
485485

486486
<!-- 11. MODAL DIALOGS ####################################################################################### -->

0 commit comments

Comments
 (0)