Add file deletion endpoint with multi-tag filtering support and redesigned editor UI with icon-only buttons
This commit is contained in:
+9
-2
@@ -8,6 +8,12 @@ from backend.indexer import index, get_vault_data
|
||||
logger = logging.getLogger("obsigate.search")
|
||||
|
||||
|
||||
def _normalize_tag_filter(tag_filter: Optional[str]) -> List[str]:
|
||||
if not tag_filter:
|
||||
return []
|
||||
return [tag.strip().lstrip("#") for tag in tag_filter.split(",") if tag.strip()]
|
||||
|
||||
|
||||
def _read_file_content(vault_name: str, file_path: str) -> str:
|
||||
"""Read raw markdown content of a file from disk."""
|
||||
vault_data = get_vault_data(vault_name)
|
||||
@@ -52,8 +58,9 @@ def search(
|
||||
"""
|
||||
query = query.strip() if query else ""
|
||||
has_query = len(query) > 0
|
||||
selected_tags = _normalize_tag_filter(tag_filter)
|
||||
|
||||
if not has_query and not tag_filter:
|
||||
if not has_query and not selected_tags:
|
||||
return []
|
||||
|
||||
results: List[Dict[str, Any]] = []
|
||||
@@ -63,7 +70,7 @@ def search(
|
||||
continue
|
||||
|
||||
for file_info in vault_data["files"]:
|
||||
if tag_filter and tag_filter not in file_info["tags"]:
|
||||
if selected_tags and not all(tag in file_info["tags"] for tag in selected_tags):
|
||||
continue
|
||||
|
||||
score = 0
|
||||
|
||||
Reference in New Issue
Block a user