Skip to content

Prepopulate document search with query string#4004

Merged
tillprochaska merged 1 commit intodevelopfrom
feat/prepopulate-document-search-query
Nov 28, 2024
Merged

Prepopulate document search with query string#4004
tillprochaska merged 1 commit intodevelopfrom
feat/prepopulate-document-search-query

Conversation

@tillprochaska
Copy link
Contributor

@tillprochaska tillprochaska commented Nov 20, 2024

This is a small enhancement and follow-up #3879. It automatically prepopulates the document-scope search input with the query string of the global search. If for example a user searches for "Elizabeth Bennet" and they click on one of the PDF results, the document-scope search input will be prepopulated with "Elizabeth Bennet". If they want to find pages relevant to their search term, they don’t have to retype the search query and can simply press enter.

As an alternative I’ve considered adding a small banner below the tab bar ("Do you want to search for 'Elizabeth Bennet' in this document?") which would probably be more obvious. Decided to try this option first as it adds less clutter to the UI. If it turns out the functionality isn’t clear to users, we can always iterate.

Screen.Recording.2024-11-20.at.19.32.12.mov

This is a small enhancement and follow-up #3879. It automatically prepopulates the document-scope search input with the query string of the global search. If for example a user searches for "Elizabeth Bennet" and they click on one of the PDF results, the document-scope search input will be prepopulated with "Elizabeth Bennet". If they want to find pages relevant to their search term, they don’t have to retype the search query and can simply press enter.

As an alternative I’ve considered adding a small banner below the tab bar ("Do you want to search for 'Elizabeth Bennet' in this document?") which would probably be more obvious. Decided to try this option first as it adds less clutter to the UI. If it turns out the functionality isn’t clear to users, we can always iterate.
@tillprochaska tillprochaska force-pushed the feat/prepopulate-document-search-query branch from c9c4c4e to 6fb37ef Compare November 20, 2024 18:31
@tillprochaska
Copy link
Contributor Author

Just for future reference, there’s one edge case where this doesn’t work properly:

If you use the ES query string syntax, e.g. elizabeth bennet properties.mimeType:application/pdf, the document search input will be prefilled with elizabet bennnet properties.mimeType:application/pdf and that will always return zero results.

However, before attempting to reliably parse ES query syntax on the client side, I think it’s best to see if this actually annoys users in practice.

Copy link
Contributor

@stchris stchris left a comment

Choose a reason for hiding this comment

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

This looks great, thanks @tillprochaska !

@tillprochaska tillprochaska merged commit c396186 into develop Nov 28, 2024
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.

3 participants