Skip to content
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

Search results dialog show an empty table of search results #9440

Closed
2 tasks done
HoussemNasri opened this issue Dec 11, 2022 · 6 comments · Fixed by #9450
Closed
2 tasks done

Search results dialog show an empty table of search results #9440

HoussemNasri opened this issue Dec 11, 2022 · 6 comments · Fixed by #9450
Labels
bug Confirmed bugs or reports that are very likely to be bugs search
Milestone

Comments

@HoussemNasri
Copy link
Member

HoussemNasri commented Dec 11, 2022

JabRef version

Latest development branch build (please note build date below)

Operating system

Windows

Details on version and operating system

JabRef 100.0.0 Windows 10 10.0 amd64 Java 18.0.2 JavaFX 19+11

Checked with the latest development build

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Type something in the global search bar
  2. Click the "search across libraries in a new window" button beside the search bar
  3. It shows an empty table even though the search algorithm has found 208 results

Note: JabRef 5.8--2022-08-10--dcec4e2 behaves normally

image

@Siedlerchr
Copy link
Member

Very odd! I debugged a bit and found that the problem is here

ObservableList<BibEntryTableViewModel> entriesViewModel = FXCollections.observableArrayList();
for (BibDatabaseContext context : stateManager.getOpenDatabases()) {
ObservableList<BibEntry> entriesForDb = context.getDatabase().getEntries();
List<BibEntryTableViewModel> viewModelForDb = EasyBind.mapBacked(entriesForDb, entry -> new BibEntryTableViewModel(entry, context, fieldValueFormatter));
entriesViewModel.addAll(viewModelForDb);

getEntries() is an emptyList for some reason the database object returned from the context does not contain any entries...

@HoussemNasri
Copy link
Member Author

I did some experiments and I'm positive this commit f7648e8 introduced the bug. Gone through the changes but I can't seem to spot anything that might cause the bug. I'm really confused!

@Siedlerchr Siedlerchr added this to the v5.8 milestone Dec 12, 2022
@Siedlerchr Siedlerchr added the bug Confirmed bugs or reports that are very likely to be bugs label Dec 12, 2022
@Siedlerchr
Copy link
Member

@HoussemNasri Yes, very odd 507a263 is the last commit that works.

@HoussemNasri
Copy link
Member Author

For me it's the one just before f7648e8

@Siedlerchr
Copy link
Member

I tested a bit more and found out it must have been something to do with loading the last open libraries.
Create a new library with some entries
Search for something
Global search works and shows entry

@Siedlerchr
Copy link
Member

I found the problem together with Houssem.
When we load a library we create a new "empty" LIbraryTab and DatabaseContext before the data is fully loaded.
Then we replaced the original bibDatabaseContext with the new one from the parser Result.
However, in stage manager the original list still contains the original databaseContext.

Siedlerchr added a commit that referenced this issue Dec 13, 2022
* Update database context in state manager after loading

Fixes #9440

* rename variables and add conmment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs search
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants