- #7: Section « Récents » dans la page d'accueil vault (5 derniers fichiers) - #8: Git tag v1.8.0 - #9: Filtres search avancés created:/modified:/size: avec parsing dates/sizes - #10: Déduplication IGNORED_DIRS (indexer.py source unique, watcher+main importent) - ROADMAP: tous les items marqués FAIT, version → 1.9.0
This commit is contained in:
+11
-4
@@ -36,6 +36,7 @@ from backend.indexer import (
|
||||
parse_markdown_file,
|
||||
_extract_tags,
|
||||
SUPPORTED_EXTENSIONS,
|
||||
IGNORED_DIRS,
|
||||
update_single_file,
|
||||
remove_single_file,
|
||||
handle_file_move,
|
||||
@@ -2445,6 +2446,9 @@ async def api_advanced_search(
|
||||
regex: bool = Query(False, description="Treat query as regex"),
|
||||
include_paths: Optional[str] = Query(None, description="Comma-separated glob patterns to include"),
|
||||
exclude_paths: Optional[str] = Query(None, description="Comma-separated glob patterns to exclude"),
|
||||
created: Optional[str] = Query(None, description="Created date filter (>date, <date, date..date)"),
|
||||
modified: Optional[str] = Query(None, description="Modified date filter (>date, <date, date..date, <Nd)"),
|
||||
size: Optional[str] = Query(None, description="Size filter (>size, <size, size..size, e.g. >1MB, <10KB)"),
|
||||
current_user=Depends(require_auth),
|
||||
):
|
||||
"""Advanced full-text search with TF-IDF scoring, facets, and pagination.
|
||||
@@ -2455,6 +2459,9 @@ async def api_advanced_search(
|
||||
- ``title:<text>`` — filter by title substring
|
||||
- ``path:<text>`` — filter by path substring
|
||||
- ``ext:<type>`` — filter by file extension
|
||||
- ``created:>2024-01-01`` — filter by creation date
|
||||
- ``modified:<7d`` or ``modified:2024-01-01..2024-06-01`` — filter by modification date
|
||||
- ``size:>1MB`` or ``size:100KB..1MB`` — filter by file size
|
||||
- Remaining text is scored using TF-IDF with accent normalization.
|
||||
- Toggles: case_sensitive, whole_word, regex
|
||||
- Path filters: include_paths, exclude_paths (glob patterns)
|
||||
@@ -2467,7 +2474,8 @@ async def api_advanced_search(
|
||||
partial(advanced_search, q, vault_filter=vault, tag_filter=tag,
|
||||
limit=limit, offset=offset, sort_by=sort,
|
||||
case_sensitive=case_sensitive, whole_word=whole_word, regex=regex,
|
||||
include_paths=include_paths, exclude_paths=exclude_paths),
|
||||
include_paths=include_paths, exclude_paths=exclude_paths,
|
||||
created=created, modified=modified, size=size),
|
||||
)
|
||||
|
||||
|
||||
@@ -3146,7 +3154,6 @@ async def api_vault_recent_files(
|
||||
raise HTTPException(status_code=404, detail=f"Directory not found: {dir}")
|
||||
|
||||
files = []
|
||||
ignored = {'.obsidian', '.trash', '.git', '.obsigate-backup', '__pycache__', 'node_modules'}
|
||||
dir_prefix = (dir or "").strip("/")
|
||||
|
||||
try:
|
||||
@@ -3156,7 +3163,7 @@ async def api_vault_recent_files(
|
||||
continue
|
||||
if entry.name.startswith('.'):
|
||||
continue
|
||||
if entry.name in ignored:
|
||||
if entry.name in IGNORED_DIRS:
|
||||
continue
|
||||
|
||||
# Skip entries whose parent dir chain contains an ignored dir (for rglob)
|
||||
@@ -3164,7 +3171,7 @@ async def api_vault_recent_files(
|
||||
skip = False
|
||||
try:
|
||||
for part in entry.relative_to(dir_path).parts[:-1]:
|
||||
if part.startswith('.') or part in ignored:
|
||||
if part.startswith('.') or part in IGNORED_DIRS:
|
||||
skip = True
|
||||
break
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user