Skip to content

feat: allows configure to consider parent folder name in queries #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

cristianoliveira
Copy link
Contributor

@cristianoliveira cristianoliveira commented Apr 3, 2025

Hello there 👋

I took the liberty to implement a feature that was missing when filtering bookmarks. Usually I organize my bookmarks in folders like projects, tools, etc and when querying the bookmarks I had to query by their exact name. I wanted to filter them but "pre filtered" by the parent name first.

Like this:

Bookmarks/
  Github home 
  python/
      Learn Python - Getting started tutorial
      advanced/
        Python Tricks - Pro tutorial

I should be able to query by tutorial and receive both suggestions, as well as, query by advanced tutorial and receive only one (see the unit tests)

I'm not sure if this is align with the direction of the plugin, feel free to close the PR if it isn't

Extra

I also added some tests and a Makefile to run then with make test

@cristianoliveira
Copy link
Contributor Author

cristianoliveira commented Apr 3, 2025

crop

@pascalbe-dev
Copy link
Owner

Hey @cristianoliveira ,

thanks for the input and sorry for the late reply. I've been quite busy recently.

This looks interesting. I do not have this use case for myself, but it does make sense and I could imagine more people who organize it this way. If it's non breaking (people without such a structure can still use it like now), I do not see a problem in applying this change.

I'll take a deeper look within the next days (probably monday). Thanks for the unit tests also. Makes total sense and I have not gotten into that here, so it's great to a first part. Awesome.

In the meantime (if you have not already), you can fork and then just use your fork as repo. I'll keep you updated here once there is news to share (and you'll see it anyway if I merge).

Thanks again and have a nice week 💪🏼

@cristianoliveira
Copy link
Contributor Author

Hey @pascalbe-dev keeping backwards compatibility makes sense! I was thinking to add a configuration to apply this behaviour

Summary:
This commit adds a feature to filter bookmarks by folder structure during search queries

Detailed Changes:
 - BrowserBookmarks.py:
   - Modified `BookmarkQuerier` instantiation to include a `filter_by_folders` parameter from preferences.
 - manifest.json:
   - Added a new setting `filter_by_folders` with select options for enabling/disabling folder filtering.
 - querier/BookmarkQuerier.py:
   - Updated `BookmarkQuerier` class to accept `filter_by_folders` parameter and modify search behavior accordingly.
 - tests/test_bookmark_querier.py:
   - Split tests into separate classes for when `filter_by_folders` is enabled and disabled. Added new test cases to ensure correct functionality when the filter is applied.

(cherry picked from commit 11c62fc)
@cristianoliveira
Copy link
Contributor Author

Added a new setting filter_by_folder to enable/disable the feature, the default is disabled :D

@cristianoliveira cristianoliveira changed the title feat: consider parent folder name for queries feat: allows configure to consider parent folder name in queries Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants