feat: add ext: operator for file extension filtering in advanced search

- Add ext: operator support to query parser in backend and frontend
- Update search documentation in README and help modal with ext: examples
- Parse ext: operator to extract file extension filter (strips leading dot, converts to lowercase)
- Filter search candidates by file extension in advanced_search function
- Add ext chip display in search UI alongside existing tag/vault/title/path chips
- Update API documentation and function
This commit is contained in:
2026-03-31 13:41:07 -04:00
parent 4c4b8be215
commit 84d3ad0e90
5 changed files with 37 additions and 16 deletions
+8 -2
View File
@@ -305,11 +305,11 @@
};
// ---------------------------------------------------------------------------
// Query Parser — extracts operators (tag:, #, vault:, title:, path:)
// Query Parser — extracts operators (tag:, #, vault:, title:, path:, ext:)
// ---------------------------------------------------------------------------
const QueryParser = {
parse(raw) {
const result = { tags: [], vault: null, title: null, path: null, freeText: "" };
const result = { tags: [], vault: null, title: null, path: null, ext: null, freeText: "" };
if (!raw) return result;
const tokens = this._tokenize(raw);
const freeTokens = [];
@@ -326,6 +326,8 @@
result.title = tok.slice(6).replace(/"/g, "").trim();
} else if (lower.startsWith("path:")) {
result.path = tok.slice(5).replace(/"/g, "").trim();
} else if (lower.startsWith("ext:")) {
result.ext = tok.slice(4).replace(/"/g, "").trim().replace(/^\./, "").toLowerCase();
} else {
freeTokens.push(tok);
}
@@ -657,6 +659,10 @@
this._addChip("path", `path:${parsed.path}`, parsed.path);
hasChips = true;
}
if (parsed.ext) {
this._addChip("ext", `ext:${parsed.ext}`, parsed.ext);
hasChips = true;
}
this._container.hidden = !hasChips;
},
clear() {