Skip to content
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

Feature: global search, keyboard shortcuts / hotkey support #6449

Merged
merged 61 commits into from May 2, 2024

Conversation

shamoon
Copy link
Member

@shamoon shamoon commented Apr 19, 2024

Proposed change

Been working on and playing with this for a while and I kinda love it. Welcome any feedback ofc.

This PR:

  • Replaces the upper search (which is currently just like a shortcut to advanced search) with a Global search that searches all docs, tags, etc
    • Hybrid search: first searches by title (db, fast) but also adds in advanced search results (e.g. using the index) for docs if not enough results are found
      • Advanced search can be disabled
    • Moved the search suggestions to the advanced search field, where I think it shoulda been all along
  • Adds hotkey shortcut keys for some things (its extremely easy to add more in the future with this)
    • Shift ? opens the help dialog

Video (all keyboard):

globalsearch.mov
Screenshot 2024-04-19 at 10 38 56 AM Screenshot 2024-04-19 at 10 43 48 AM

Obviously this is mostly frontend, as far as the backend part I looked into different ways to search across models and this actually seemed the best. Of course, welcome any thoughts on that part in parcticular

Closes #240 but mostly I just think its way better than the current thing

Type of change

  • Bug fix: non-breaking change which fixes an issue.
  • New feature / Enhancement: non-breaking change which adds functionality. Please read the important note above.
  • Breaking change: fix or feature that would cause existing functionality to not work as expected.
  • Documentation only.
  • Other. Please explain:

Checklist:

  • I have read & agree with the contributing guidelines.
  • If applicable, I have included testing coverage for new code in this PR, for backend and / or front-end changes.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • If applicable, I have checked that all tests pass, see documentation.
  • I have run all pre-commit hooks, see documentation.
  • I have made corresponding changes to the documentation as needed.
  • I have checked my modifications for any breaking changes.

@shamoon shamoon requested review from a team as code owners April 19, 2024 18:24
@shamoon shamoon added this to the Next Release milestone Apr 19, 2024
@paperless-ngx-secretary paperless-ngx-secretary bot added backend frontend non-trivial Requires approval by several team members labels Apr 19, 2024
@github-actions github-actions bot added the enhancement New feature label Apr 19, 2024
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.18%. Comparing base (40289cd) to head (05b4ba5).

❗ Current head 05b4ba5 differs from pull request most recent head 75578ef. Consider uploading reports for the commit 75578ef to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6449      +/-   ##
==========================================
+ Coverage   97.11%   97.18%   +0.06%     
==========================================
  Files         430      436       +6     
  Lines       17499    17925     +426     
  Branches     1386     1516     +130     
==========================================
+ Hits        16995    17421     +426     
  Misses        501      501              
  Partials        3        3              
Flag Coverage Δ
backend 95.87% <100.00%> (+0.02%) ⬆️
frontend 98.62% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shamoon shamoon enabled auto-merge (squash) April 20, 2024 00:52
@shamoon shamoon added the notable Flag PRs to highlight in releases label Apr 20, 2024
@shamoon shamoon changed the title Feature: global search, shortcuts / hotkey support Feature: global search, keyboard shortcuts / hotkey support Apr 20, 2024
@nimodius
Copy link

WOw I very much like the look of this, excited to try it. Thank you paperless team for all the amazing work!!

@shamoon shamoon mentioned this pull request Apr 25, 2024
12 tasks
@shamoon
Copy link
Member Author

shamoon commented Apr 28, 2024

One update here: I realized the current iteration could lose access to running an advanced search in the way the current thing does, so I've added an 'Advanced search →' button that shows if:

  1. Advanced search is disabled (so no advanced search results are shown) OR
  2. Advanced search is enabled and the number of documents returned is the limit i.e. theres a possibility for more results.

See screenshots.

Potentially more results (same if advanced search disabled):
Screenshot 2024-04-28 at 9 46 01 AM

Only 1 result and advanced already enabled (no button):
Screenshot 2024-04-28 at 10 10 11 AM

Copy link
Member

@stumpylog stumpylog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to test all the changes, but what I managed to seems to be working

@shamoon shamoon merged commit c6e7d06 into dev May 2, 2024
29 checks passed
@shamoon shamoon deleted the feature-global-search branch May 2, 2024 16:15
danielrheinbay pushed a commit to danielrheinbay/paperless-ngx that referenced this pull request May 5, 2024
@reinob
Copy link

reinob commented May 7, 2024

I just updated to 2.8.1 (THANKS!), and have noticed that in the global search the text is black and the background dark green. Like in the screenshots above, except that the text is black (see screenshot).

global_search

Is this configurable somewhere? (I find it very hard to read).
(I'm using Firefox 125.0.3, and have currently nothing else to test it with).

@shamoon
Copy link
Member Author

shamoon commented May 7, 2024

#6602

@denilsonsa

This comment was marked as off-topic.

@shamoon
Copy link
Member Author

shamoon commented May 7, 2024

Please dont comment on a merged PR, you can open discussion(s), thanks

@paperless-ngx paperless-ngx locked as resolved and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend enhancement New feature frontend non-trivial Requires approval by several team members notable Flag PRs to highlight in releases
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants