Skip to content

Suggest journal keywords during submission#5265

Open
kopfduenger wants to merge 1 commit intoopenlibhums:masterfrom
kopfduenger:community/journal-keyword-suggestions
Open

Suggest journal keywords during submission#5265
kopfduenger wants to merge 1 commit intoopenlibhums:masterfrom
kopfduenger:community/journal-keyword-suggestions

Conversation

@kopfduenger
Copy link
Copy Markdown

No description provided.

@kopfduenger
Copy link
Copy Markdown
Author

This PR adds journal-level keyword suggestions to the submission metadata keyword field.

The goal is to make the existing journal disciplines/keywords more useful during submission: when authors or editors enter article keywords, the Tag-it field now receives request.journal.keywords as availableTags in both the author submission metadata step and the admin metadata edit view. This keeps free keyword entry intact while surfacing the journal’s configured vocabulary as suggestions.

The implementation also escapes the rendered keyword values for JavaScript output, and I added tests for both submission and metadata-edit views to confirm that journal keywords appear as suggestions.

@ajrbyers
Copy link
Copy Markdown
Member

Thanks for this submission. I can see it would work well for a small set of keywords, however, we'd need this solution to work well for n+1 keywords. As an example the OLH along has 56,000 keywords in its database.

@kopfduenger
Copy link
Copy Markdown
Author

Good point, thanks. The current implementation inlines the journal keyword list into the page, which is fine for a small controlled discipline list but would not scale for large keyword sets such as OLH’s.

I’ll rework this to use server-side autocomplete instead: the form will request matching keyword suggestions only after the user starts typing, and the backend will return a limited result set. That should avoid loading all keywords into the page while preserving the suggestion behaviour.

@ajrbyers
Copy link
Copy Markdown
Member

Good point, thanks. The current implementation inlines the journal keyword list into the page, which is fine for a small controlled discipline list but would not scale for large keyword sets such as OLH’s.

I’ll rework this to use server-side autocomplete instead: the form will request matching keyword suggestions only after the user starts typing, and the backend will return a limited result set. That should avoid loading all keywords into the page while preserving the suggestion behaviour.

We're standardising our approach to reactive interfaces using HTMX, not sure if that's something you've come across before.

@kopfduenger
Copy link
Copy Markdown
Author

Thanks, that makes sense. I’m familiar with the general idea of HTMX, though I haven’t used it much in Janeway yet.
I’ll take a look at the existing Janeway HTMX patterns and rework this so keyword suggestions are fetched server-side with a limited result set, rather than inlining all keywords in the page.

@kopfduenger
Copy link
Copy Markdown
Author

I had a quick look through the current codebase and couldn’t find existing HTMX usage or established hx-* patterns yet, so I’m guessing this is a direction you’re standardising on rather than something already widely present in the codebase? Is there a preferred Janeway HTMX pattern or branch I should follow? Otherwise I can propose a small HTMX-based server-side autocomplete with a limited result set instead of inlining all keywords into the page.

@ajrbyers
Copy link
Copy Markdown
Member

You are correct. We have some PRs in the works that we're using HTMX for, I can pull some out this afternoon and send them to you.

@kopfduenger
Copy link
Copy Markdown
Author

Great, thank you.

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