Escaping ':' in search queries, except if advanced=true#4207
Escaping ':' in search queries, except if advanced=true#4207ineiti wants to merge 5 commits intoDSpace:mainfrom
Conversation
a8e8917 to
ecb9e2f
Compare
|
@ineiti i like the idea of this a lot, just one tip:
If you fix that, the other parse errors in the template should go away. Regarding the advanced form control itself... probably worth discussing the best way to make this available without being intrusive. An extra tab up the top? If you go with the checkbox, where to put it, how to style it, etc In some quick testing, I don't see a difference between checked=true and checked=false, but that part still seems WIP so I'll hold off for now! |
|
@kshepherd OK, thanks. I added some more propagation of the Lazy question: is there a place in the documentation which shows how to easily test the frontend with an example backend? |
|
Thanks a lot for this contribution, @ineiti . This issue has been quite disruptive for end users across DSpace-based repositories. From the perspective of repository managers, this bug has a significant impact, as searching by known title is one of the most common behaviors among users. Unfortunately, many publication titles include colons (:), making this issue especially frustrating for non-technical users who often have no idea why their search returns no results unless they use quotes or escape characters,a workaround very few are aware of. At the same time, I completely agree with preserving the possibility to search within specific metadata fields, as it remains an important feature for curators and advanced users. So finding a balance between simplicity for the general public and power for expert users is key here. Regarding the UI proposal in this PR: rather than a simple checkbox, I would suggest introducing a toggle button below the search bar that would allow users to switch between a basic (or simple) search mode where colons would be escaped automatically and an expert mode that retains the full indexing syntax. I would avoid the term advanced, since some repositories already offer an "advanced search" with multiple fields and boolean operators, and we don't want to create confusion. Design-wise, this toggle should ideally be compatible with both the main search bar on the homepage and the slightly different one displayed after an initial search (which includes the collection scoping dropdown). The toggle should remain unobtrusive, with a clear visual indicator when expert mode is active : something akin to the way ChatGPT activates "Search Mode" (web access) with a small switch and indicator could serve as inspiration. Really looking forward to seeing how this evolves and happy to collaborate further or test the changes if helpful! |
|
@ineiti the default configuration should actually point you to the sandbox server, I think. Does it not work like that for you out of the box? You can also take a look at the instructions here: https://wiki.lyrasis.org/display/DSPACE/Try+out+DSpace+9#TryoutDSpace9-InstalltheUserInterfaceonly If you run docker, the docker-compose files provided in the angular src also allow this |
|
@ineiti if this is still a work-in-progress you can give it draft status or add the work-in-progress label, then toggle back once you're ready for review. |
That's exactly what I was looking for! Thanks a lot :) As I consider having been Nerd Sniped by our admins, I'm trying to spend as little time on this as possible :) |
60c0132 to
f5fcc30
Compare
|
Here goes a version which works locally. Unfortunately I was not able to get the Please let me know what you think of this PR, and if it also works in your tests. |
|
@jsicot is there something I can do to advance this? |
|
@ineiti : Unfortunately, this PR missed our deadline for new features in 9.0, which was back on March 28. So, I've had to move this to our 10.0 board (10.0 is due in May 2026). That said, others are still welcome to review this, test it & give feedback, and we could always merge it immediately after 9.0 goes out the door, assuming it has positive feedback. |
|
I think this is a great prototype for an improvement that could use some extra discussion regarding the UX, to help us make the functionality really clear and to help plan for future improvements to the search forms |
|
OK, thanks for the update - I'll keep an eye on my github notifications in case something comes up :) |
|
@ineiti : We discussed this briefly as a team in our weekly Developers Meeting today. Overall, we agree this is a bug. But, there's some concerns about the design of adding a checkbox next to the searchbox, as that doesn't seem very user friendly. In order to help others to visualize the design, could you add a screenshot or two of the new look to this PR? If this PR moves forward, we'd need to have more automated tests added. For instance, the new checkbox in the |
|
@tdonohue - Sorry, been on holidays. Should catch up faster now :) The screenshots are shown above in my comment from 17th of April: Default value is this:
When you click in the "Simple" rectangle, it changes to:
Clicking in the "Expert" rectangle, it changes back to the previous. This is based on 5 minutes Google search how to do such a thing, I'm sure that with Claude, or an actual UI engineer, you'll have a much better display. The CSS is here: And I'd be happy to add some more tests, if we agree on a good UI for it. |
|
Hi @ineiti, |
b9e6ca4 to
d546337
Compare
|
Rebased on latest main - let me know if you need anything else. |
|
@ineiti : Apologies that we have not gotten a reviewer on this PR yet. However, we are just beginning a more detailed review process for 10.0 for all new feature PRs. If you can rebase this on latest |
Following up on the issue DSpace/DSpace#9670 - here is a first proposal. Per default, this sets the 'advanced' flag to false and will escape ':' characters in the search string. Only with 'advanced = true' is the search string passed as-is. TODO: - add tests - make sure this looks good
d546337 to
ce5309e
Compare
|
OK - that was easier than I thought... Let's see if it passes the tests! |





References
DSpace/DSpace#9670
Description
Fixes DSpace/DSpace#9670 by escaping ':' in search queries, except if 'advanced == true'.
It does the following:
TODO:
Instructions for Reviewers
Try to search for something which includes a colon at the end of the word.
Then click the 'advanced' checkbox and try to search using advanced search features.
Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.