Repository navigation
Search docs: a JsonLogic query that selects a value can't tell a missing field from an empty one #371
Replies: 1 comment
|
Thanks so much for such a careful write-up! You're completely right: a query that selects a value can't tell an empty field from a missing one, and the docs never spelled that out. I hope it didn't cost you too much time to track down. Since the change was small and you'd already done the hard part of figuring out what was going on, I went ahead and put together #376 based on your proposal. It adds One wrinkle turned up along the way: That documentation change will go out in the next release! |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I use this plugin every day to read and write my vault from scripts, and I'd like to offer a small documentation change. Before opening a PR I wanted to check whether it's welcome, and how you'd like it shaped.
What I ran into. The
/search/docs say results are "non-falsy" and list the falsy values. What they don't spell out is the consequence. A query that selects a value rather than testing a condition, like{"var": "frontmatter.aliases"}, drops notes where the field is[],false,0or""exactly as it drops notes that don't have the field at all. I had a script treating "not in the results" as "doesn't have the field", and it was quietly wrong.On my vault (about 2,300 notes):
{"var": "frontmatter.aliases"}returns 1,078 notes{"!": {"missing": ["frontmatter.aliases"]}}returns 1,102 notesThe 24 missing ones all have
aliases: [].A smaller point:
isTruthyalso treats""as falsy, and the list in the docs leaves it out.What I'd propose (docs plus one test, no behavior change):
search-post.md: a short paragraph on the consequence, pointing tomissingfor presence tests, and""added to the falsy list.openapi.jsonnet, withopenapi.yamlregenerated.search_queryMCP tool description, per AGENTS.md's keep-in-sync guidance.missingtells them apart.I have this drafted on a local branch, and
npm testpasses. Happy to adjust the wording, trim it to the docs only, or leave the MCP description alone if you'd prefer. And if you'd rather this didn't go in at all, that's completely fine too.In the spirit of AGENTS.md: I drafted this with an AI assistant (Claude), then reviewed it and ran the tests myself.
Thanks for the plugin. It's the backbone of how I work with my notes.
All reactions