-
-
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
Fixes exception in preview using regexp search and regexp search without specified field #7073
Fixes exception in preview using regexp search and regexp search without specified field #7073
Conversation
Is there a good spot to put test cases for this issue? |
This PR can be made better by some larger reformatting but there might not be a point to doing it given that the code should be completely replaced by Lucene. |
I think it's not too important to have the highlighting that accurate for each complicated regex and yeah in the longterm we plan to use/convert to lucence. And thanks for finding the issue with the grammar based search + the regex! |
As you are at the search code and as you also worked on the unicode normalization, can you maybe check that issue here as well? #6815 |
Sure, will do ! |
I agree, and I haven't really looked into this in enough detail to contribute. There are definitively still going to be other issues after this PR. It just aims to address the most obvious cases of the
Thank you for the sanity check and help, it is both appreciated and saves me time ^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first, LGTM.
Minor issue with a magic string replacmenet 😇
May I ask whether its possible to add a test case for the fixed functionality?
I'll look into it tomorrow. I don't have any experience writing tests for this type of code but there should be some "template" I can use elsewhere. |
Regarding tests, you are lucky, as there is already one: https://github.com/JabRef/jabref/blob/master/src/test/java/org/jabref/model/search/rules/ContainBasedSearchRuleTest.java |
I keep running into the same issue with creating a BibDatabaseContext databaseContext = new BibDatabaseContext();
StateManager stateManager = new StateManager();
stateManager.setSearchQuery(new SearchQuery("test", false, false));
PreviewViewer pw = new PreviewViewer(databaseContext, null, stateManager); As soon as I call the constructor I get a java.lang.ExceptionInInitializerError (i.e., before it enters the constructor) |
If you want to test something on the javafx thread, you need to use the testfx extensions and declare it as GUI test: |
@Siedlerchr @koppor thank you both for your reviews! They are very appreciated!
Great! In that case, I'll put adding a test case for this issue on my todo-list for later. |
Fixes #6777 . The issue originates in how the JavaScript regexp is created in
PreviewViewer#highlightSearchPattern
.Liu.*
)Change in CHANGELOG.md described (if applicable)Screenshots added in PR description (for UI changes)