jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Search results linger in Main Table when a new search returns no matches

Open rbellazar opened this issue 6 months ago β€’ 19 comments

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

  1. Open a library with multiple entries.
  2. Search for a term that matches "Entry A".
  3. Immediately search for a term that matches "Entry B".
  4. 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!");

}

Image Image Image

Appendix

...

Log File
Paste an excerpt of your log file here

rbellazar avatar May 10 '26 13:05 rbellazar

/assign-me

madhav758 avatar May 16 '26 05:05 madhav758

⚠️ 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-me on an issue you're no longer working on
  • Ask a maintainer for an exception if this is a special case

jabref-machine avatar May 16 '26 05:05 jabref-machine

/assign-me

madhav758 avatar May 16 '26 05:05 madhav758

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.

jabref-machine avatar May 16 '26 05:05 jabref-machine

πŸ‘‹ 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.

jabref-machine avatar May 25 '26 20:05 jabref-machine

/assign-me

suhanikhanna31 avatar May 25 '26 20:05 suhanikhanna31

πŸ‘‹ 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! πŸš€

jabref-machine avatar May 25 '26 20:05 jabref-machine

Hi! I would like to work on this issue. I am currently investigating the bug and will provide updates here.

gabrielSossai avatar Jun 14 '26 20:06 gabrielSossai

πŸ‘‹ 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.

jabref-machine avatar Jun 14 '26 20:06 jabref-machine

/assign-me

gabrielSossai avatar Jun 14 '26 20:06 gabrielSossai

πŸ‘‹ 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! πŸš€

jabref-machine avatar Jun 14 '26 20:06 jabref-machine

⏰ 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!

github-actions[bot] avatar Jun 21 '26 12:06 github-actions[bot]

/assign-me

MarkOmelyanenko avatar Jul 07 '26 12:07 MarkOmelyanenko

πŸ‘‹ 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! πŸš€

jabref-machine avatar Jul 07 '26 12:07 jabref-machine

@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?

MarkOmelyanenko avatar Jul 07 '26 16:07 MarkOmelyanenko

@koppor

Difficult times these days.

What is your mother tongue?

Do you know the difference between markdown and markdown fenced block?

koppor avatar Jul 07 '26 17:07 koppor

@koppor

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 avatar Jul 07 '26 20:07 MarkOmelyanenko

@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

Siedlerchr avatar Jul 07 '26 20:07 Siedlerchr

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.

github-actions[bot] avatar Jul 14 '26 09:07 github-actions[bot]