-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Regular expression in search field and group delivers strange results #12163
Comments
The regex option has no effect on "field = value" expressions. To use regex with field names, the expression must have the form "field =~ value", which will apply the regular expression regardless of the ".*" regex option. The idea makes sense, because it allows regex and non-regex terms to coexist in the same search. However, in practice this is totally unintuitive and not worth the trade-off. My suggestion for the maintainers is to keep "field =~ value" explicit (always apply regex syntax for this term) and make "field = value" apply standard or regex syntax, depending on the regex button/checkmark. In other words, Personally, I keep regex enabled all the time, so adding escape characters as needed has become second nature. This is how the search currently works in the development version.
|
@ytzemih Thank you for reporting. Since this is a freetime project and heavily depending on volunteers, I would like to ask you if you could spend some time on crafting a "minimal working example". Maybe, you can use a bib file from https://github.com/JabRef/jabref/tree/main/src/test/resources/testbib and check if you can reproduce the issue there? Note that the whole endevour was a Google Summer of Code project (https://github.com/JabRef/jabref/wiki/GSoC-2024-%E2%80%90-Lucene-Search-Backend-Integration). The contributor continued on the project to have the search syntax similar to v5.15 (again) - but we extended it (as explained at #12163 (comment)) to enable mixed use of RegEx and non-regex. |
@ryan-carpenter and @koppor: Thanks for getting back to me. First of all: I keep RegEx on all the time, too. My problem is rather simple: I couldn't find what @ryan-carpenter explains on https://docs.jabref.org/finding-sorting-and-cleaning-entries/search#regular-expressions. Yesterday, I carefully studied this website to get things right. But, now I understand why my search expressions don't work under JR 6. Regarding the MWE and the testbibs: I tested my expressions now with JR6 using Your rationale are sound, perhaps a little too ambitious for the seasoned JR user, but fine if you communicate it in the help. Without clear help, the mixed syntax might be confusing for some users like me.
This sounds like the removal of the RegEx button may avoid confusion once and for all? On a side note, I know about JR being a free-time project, hence, I'm contributing bug reports (because I've not enough time to actually code). I've been using JR for almost 20 years now. Great tool, and cool that you allow GSoC contributors to bring innovations into the game, with the hassle that new developers might create at times ... I've been young myself and not all of my source code contributions have been "perpetual pearls" ... ;) Anyway, thanks for all your work. (I've bumped into some Java exceptions, but will file them separately.) |
WDYT? Currently, I think, this is good, because users might want to write simple queries as "abc and title=def" and then say: OK, please do that case-sensitive and use regex. - and for all of the two search sub terms. |
No, the other way round: Just have the button set the interpretation of all sub terms, and not a mixed interpretation. Example:
Currently: RegEx on: Does NOT match the entry, because title does not end with a dot. Proposal: RegEx on: Matches the entry, because title contains a letter after
👍 - Maybe, we can meet at "JabCon" and code for three days next year? 😅 The sight seeing on JabCon is rewarding! 😅
Nice! Longer than me then 😅.
Yes, please. We try to curate them. |
@koppor Ah, I see where you're getting at. I'd support the proposal. Because the current behavior seems quite intricate/unintuitive. Didn't know about JabCon, where will it take place? Not sure whether I can join but cool to see that there is such a thing. |
We write very seldomly about it. We have a "small" homepage (https://jabcon.jabref.org/), but the blog posts tell more (https://blog.jabref.org/tags/jabcon/) - I just added a link to it from the JabCon page. |
Precisely. The button is important because:
The ability to apply regex searching with
|
Same for me. I knew something had changed but could not recall where I had seen the news. Checked Github. Checked Discourse. Asked on Gitter. Finally realised I had seen it in the regex button tooltip! |
Fixed 😅 - https://docs.jabref.org/finding-sorting-and-cleaning-entries/search#modifiers-for-fields |
Thanks! Today, I learned more about JR. |
@ytzemih, Lucene syntax was reverted to JabRef syntax, so I think this issue can be closed |
@ryan-carpenter, thanks, I saw that. Yes, can be closed from my PoV. |
JabRef version
Latest development branch build (please note build date below)
I tried the build from 2024-11-05 23:12
Operating system
GNU / Linux
Details on version and operating system
Linux Mint/Debian 12
Checked with the latest development build (copy version output from About dialog)
Steps to reproduce the behaviour
There are perhaps several issues at play. But my focus was on getting a search done. The migration back to the old (nice) search seems not to be a faithful migration. I discovered these issues after migrating the search expressions from 5.16 back to the old search. Thanks for checking this.
I have switched back to JR 5.15 and the back-migrated search expressions work pretty well again.
Appendix
...
Log File
The text was updated successfully, but these errors were encountered: