Skip to content

Refresh fulltext search results when database change#13384

Merged
Siedlerchr merged 6 commits intoJabRef:mainfrom
ZodGaz:fix-for-issue-13241
Jun 23, 2025
Merged

Refresh fulltext search results when database change#13384
Siedlerchr merged 6 commits intoJabRef:mainfrom
ZodGaz:fix-for-issue-13241

Conversation

@ZodGaz
Copy link
Copy Markdown
Contributor

@ZodGaz ZodGaz commented Jun 20, 2025

Closes #13241

We found out the issue was that the searchResults in the FullTextResultsTab would be empty after switching databases, making the tab appear blank. This happened because the listener (and consequently other listeners) on the SearchQuery inside MainTableDataModel wasn't firing since it didn't detect a different query (oldValue == newValue).

As other maintainers suggested, we could have fixed this by emptying the query and then refilling it, but that risked thread-concurrency issues and breaking functions relying on SearchQuery not being empty. Another solution was toggling the fulltext flag when switching databases, but that caused extra loading times and weird UI behavior.

The solution I went with: just remove the FULLTEXT flag from the searchQuery's flag list. This triggers the search refresh. No need to manually re-add the flag because the UI listeners will put it back automatically in the same event cycle. Yeah it's a workaround, but it's cheaper and faster than a full investigation and major refactoring.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

ZodGaz added 2 commits June 17, 2025 03:24
…rewrote shouldShow in FileAnnotationTab as requested in JabRef#13279
forcing a search refresh only when the fulltext flag is on, removing and re-adding the flag from the query when the database is switched.
@koppor
Copy link
Copy Markdown
Member

koppor commented Jun 21, 2025

Related PR: #11268

@ZodGaz ZodGaz changed the title Fix for issue 13241 Refresh fulltext search results when database change Jun 21, 2025
@ZodGaz ZodGaz marked this pull request as ready for review June 21, 2025 14:10
Comment on lines +113 to +116
// We need to call this when the database is switched during a fulltext search since
// the listener on the searchQueryProperty will not fire if the query doesn't change
// (this causes searchResults in FullTextResultsTab to be empty)
// https://github.com/JabRef/jabref/issues/13241
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indnet.

Use Three slashes for JavaDOC method comments.

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 22, 2025
@trag-bot
Copy link
Copy Markdown

trag-bot Bot commented Jun 22, 2025

@trag-bot didn't find any issues in the code! ✅✨

@Siedlerchr Siedlerchr added this pull request to the merge queue Jun 23, 2025
Merged via the queue into JabRef:main with commit 9af2a64 Jun 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search results tab is blank after switching library

3 participants