Account search by keywords/aliases (e.g. "car" → Expenses:Vehicle:Gas) #47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Let webapp (and the Libra UI) find accounts by keyword/alias, not just by exact hierarchical name. Typing "car" should surface
Expenses:Vehicle:Gas, "rent" →Expenses:Housing:Rent, etc. Improves account selection during expense/receivable entry, especially for non-accountant collective members who don't know the chart layout.Mechanism is settled; storage location is the open question
A Beancount
opendirective can carry arbitrary metadata, so keywords can live on the account itself:Verified constraints from the Beancount grammar:
STRING | account | DATE | currency | TAG | BOOL | NONE | number | amount) — no list type, and keys are unique per directive. So keywords are one delimited string (space- or comma-separated), not a list.[a-z][a-zA-Z0-9\-_]+, sokeywordsis a valid key.Important: metadata is storage only — nothing reads it for search automatically. Fava's own account filter matches account names only. The matching behavior is ours to build regardless of where keywords are stored.
Decision: where do keywords live?
Leaning (not decided): keywords are intrinsically about the account and benefit from being edited once and traveling with it → Beancount metadata as source of truth, synced into Libra's account model for search. The
descriptionmetadata we already write is a mild precedent. But the "keep the ledger clean / it's a UX concern" case for the Libra DB is legitimate. Pick one before building.Implementation sketch (once storage is decided)
If Beancount metadata:
keywordsfield to the add-account dialog +CreateChartAccountmodel; writekeywords:metadata informat/add_account(reuse the new_escape_beancount_string).keywordsthroughaccount_syncinto Libra's account model /AccountWithPermissions.If Libra DB:
keywords/aliasescolumn to the account operational store + a small edit UI.Out of scope / dependencies
_escape_beancount_stringfrom that PR if the metadata route is chosen.