Implement relation name wildcard feature#8640
Implement relation name wildcard feature#8640misch334 wants to merge 7 commits intoTriliumNext:mainfrom
Conversation
Summary of ChangesHello @misch334, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the search functionality within Trilium Notes by introducing a relation name wildcard. This allows users to perform more flexible and intuitive searches, retrieving notes connected by any type of relation—whether explicit or an internal link—without needing to specify the exact relation name. The change simplifies the search process, making it easier to discover related content and reducing cognitive overhead for users. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a useful wildcard search for relations, allowing users to query for any relation type. The implementation is mostly solid, with additions to the search syntax documentation and new tests. I've identified a potential performance improvement in the wildcard search logic and a couple of minor style inconsistencies. Overall, a great addition to Trilium's search capabilities.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| // This wildcard should be a symbol/character different from lexer operators. | ||
| // It also should use char(s) not allowed in relation names ([0-9a-zA-Z:_]), | ||
| // to prevent ambiguity. As alternative in future, a more sophisticated lexer | ||
| // might create separate token types, with relation wildcard being one of them. | ||
| const RELATION_NAME_WILDCARD = "?"; |
There was a problem hiding this comment.
One thing to add: By “lexer” this module is meant. Its operators are used to split the tokens, hence e.g. * was not possible to use as relation name wildcard.
Currently this lexer returns an array of tokens. Later on it might be extended as “more sophisticated” lexer to also return token type identifiers, like REL_NAME_WILCARD for char ? within relation name. These enriched tokens then can be interpreted more flexibly by parse.ts.
Though this PR seems sufficient for now.
There was a problem hiding this comment.
Another alternative is to add conditional logic for the token seqence ~? (Relation ~ + whatever symbol the relation wildcard has, here ?) in lexer, so that wildcard is not mis-interpreted as one of the lexer operators. But this change would only be needed, if we should decide to re-use an existent operator symbol like *.
With ? it works without any lexer modifications, and question mark is easily interpreted as wildcard, hence I am in favor of it.
Trilium Notes currently has the limitation, that one needs to explicitely specify the kind of relation to query for, when using search dialog. Users need to actively
Intent of this PR is to reduce this mental load of users. It also strives to align Trilium Notes with other Note taking apps.An example is Logseq, where page links can be unformely queried, regardless if properties (akin to Trilium explicit relations) are used or in-content links. Further filtering by properties is just optional.
I used a dummy database with note size of 10.000 to test performance (let me know, if shell script for dummy note creation is of interest). There wasn't any noticeable delay in search dialog in combination with relation wildcard search
~?.