Search results linger in Main Table when a new search returns no matches
JabRef version
5.15 (latest release)
Operating system
Windows
Details on version and operating system
Windows 11
Checked with the latest development build (copy version output from About dialog)
- [x] I made a backup of my libraries before testing the latest development version.
- [x] I have tested the latest development version and the problem persists
Steps to reproduce the behaviour
When performing consecutive searches, the results from the previous search remain visible in the main table alongside the new results. This appears to be a race condition in the asynchronous updateSearchMatches logic within MainTableDataModel
- Open a library with multiple entries.
- Search for a term that matches "Entry A".
- Immediately search for a term that matches "Entry B".
- Observe that both "Entry A" and "Entry B" are visible in the table.
I have verified this bug using the following JUnit 5 test case added to MainTableDataModelTest.java. This test fails with an AssertionFailedError because the matching count is 2 instead of 1.
@Test void searchResultsAreClearedBetweenQueries() throws InterruptedException { BibEntry entry1 = new BibEntry().withField(StandardField.TITLE, "Quantum Physics"); BibEntry entry2 = new BibEntry().withField(StandardField.TITLE, "Organic Chemistry");
bibDatabaseContext.getDatabase().insertEntry(entry1);
bibDatabaseContext.getDatabase().insertEntry(entry2);
// Trigger consecutive searches via the searchQueryProperty
searchQueryProperty.setValue(Optional.of(new SearchQuery("Quantum")));
searchQueryProperty.setValue(Optional.of(new SearchQuery("Organic")));
// Wait for BackgroundTask to complete
Thread.sleep(500);
long matchingCount = mainTableDataModel.getEntriesFilteredAndSorted().stream()
.filter(view -> view.isMatchedBySearch().get())
.count();
assertEquals(1, matchingCount, "Previous search results are still visible!");
}
Appendix
...
Log File
Paste an excerpt of your log file here
/assign-me
β οΈ Assignment Limit Reached
Hi @madhav758, you've reached the maximum number of 3 concurrent assignments.
[!NOTE] Please complete or unassign from your current issues before taking on new ones.
Current options
- Complete one of your assigned issues and close it
- Use
/unassign-meon an issue you're no longer working on - Ask a maintainer for an exception if this is a special case
/assign-me
Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.
At this point in time, you raised 2 pull request(s) of which 0% (0/2) have been merged.
π Hey @suhanikhanna31, looks like youβre eager to work on this issue β great! π It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.
/assign-me
π Hey @suhanikhanna31, thank you for your interest in this issue! π
We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.
For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.
In case you encounter failing tests during development, please check our developer FAQs!
Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.
Happy coding! π
Hi! I would like to work on this issue. I am currently investigating the bug and will provide updates here.
π Hey @gabrielSossai, looks like youβre eager to work on this issue β great! π It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.
/assign-me
π Hey @gabrielSossai, thank you for your interest in this issue! π
We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.
For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.
In case you encounter failing tests during development, please check our developer FAQs!
Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.
Happy coding! π
β° Assignment Reminder
Hi @gabrielSossai, this is a friendly reminder about your assignment to this issue.
[!WARNING] This issue will be automatically unassigned in 7 days if there's no activity.
Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.
How to keep your assignment
If you are working on it, you can prevent automatic unassignment by:
- Submitting a draft pull request with your progress within 7 days
- Asking for the π Pinned label if you need more time
We appreciate your contribution and are here to help if needed!
/assign-me
π Hey @MarkOmelyanenko, thank you for your interest in this issue! π
We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.
For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.
In case you encounter failing tests during development, please check our developer FAQs!
Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.
Happy coding! π
@koppor Hi, I noticed that PR #16137 previously addressed this issue using a latest-search-wins update ID, but it was closed without being merged.
Before opening another PR, I wanted to ask whether there were specific technical concerns or design reasons that led to this PR being closed.
I saw some review concerns around moving bulk entry updates to the JavaFX thread and handling failures of the latest search task, but I am not sure whether these were the actual reasons for closing the PR.
Could you please clarify what the main concerns with the previous approach were?
@koppor
Difficult times these days.
What is your mother tongue?
Do you know the difference between markdown and markdown fenced block?
Difficult times these days.
What is your mother tongue?
Do you know the difference between markdown and markdown fenced block?
Okay, I think I understand what you mean now. But I just want to double-check: do you mean the issues with how the PR was formatted and the kind of information that was included in it?
My mother tongue is Ukrainian. If anything in my message is unclear or sounds odd, please feel free to ask and I will clarify it.
@MarkOmelyanenko The PR was closed because it didn't follow our template and the comments from the bot were not addressed. Just make sure to follow the PR guidance/template. We didn't take a look at the code because the contributor did not even follow the guidelines
We think that this issue was fixed. Please head to https://builds.jabref.org/main to download a development build and try it out.
For any feedback, add a comment to the pull request at https://github.com/JabRef/jabref/pull/16212.