Skip to content

[Port to stable] Restore full-text results in the entry editor - #17370

Closed
jabref-machine wants to merge 7 commits into
stablefrom
port-17367-to-stable
Closed

jabref-machine wants to merge 7 commits into
stablefrom
port-17367-to-stable

Conversation

@jabref-machine

Copy link
Copy Markdown
Collaborator

Port of #17367 to stable, see Branching strategy.

If this PR is a draft, the cherry-pick conflicted: the conflicting files are committed with Git's conflict markers left in. Resolve the markers locally, push, and mark the PR ready.

@jabref-machine

Copy link
Copy Markdown
Collaborator Author

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin port-17367-to-stable
git worktree add --checkout .worktree/port-17367-to-stable port-17367-to-stable
cd .worktree/port-17367-to-stable
git reset --hard HEAD^
git cherry-pick -x 091e8897bcd9f7dcecbb499ae6e48332ffefec21

@koppor

koppor commented Oct 4, 2026

Copy link
Copy Markdown
Member

#17285 needs to be ported first.

@Siedlerchr
Siedlerchr marked this pull request as ready for review October 26, 2026 20:18
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Restore full-text results in the entry editor on stable

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Backports per-library full-text results so the entry editor displays matching text and page links.
• Clears stale results on new searches and library switches, with regression tests.
• Adds requirements and a changelog entry; the requirements file still contains conflict markers.
Diagram

graph TD
SC["Search context"] --> MT["Table model"] --> LT["Library tab"] --> EE["Results tab"]
SM["State manager"] --> EE
Loading
High-Level Assessment

Publishing results from the per-library table model is preferable to storing them on the shared search query: it lets the editor observe completed searches without carrying results across libraries. Resolve the conflict markers in the requirements file before merging.

Files changed (8) +240 / -37

Bug fix (3) +95 / -37
LibraryTab.javaExpose search results for each library +12/-0

Expose search results for each library

• Binds a read-only results property to the table model and exposes it to consumers. Unbinds it when the library tab closes.

jabgui/src/main/java/org/jabref/gui/LibraryTab.java

FulltextSearchResultsTab.javaRender results from the active library +65/-33

Render results from the active library

• Observes completed results from the active library instead of reading results from the search query. Clears and rerenders content as searches or libraries change, and removes listeners on disposal.

jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java

MainTableDataModel.javaPublish current search results to the editor +18/-4

Publish current search results to the editor

• Adds a read-only property for detailed search results alongside table match flags. Clears stale results on new searches and guards both clearing and completion against out-of-order updates.

jabgui/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java

Tests (2) +121 / -0
FulltextSearchResultsTabTest.javaTest result rendering and library switching +117/-0

Test result rendering and library switching

• Verifies that a completed search populates file text and page links in an open editor tab. Also verifies that updates from a previously active library no longer affect the display.

jabgui/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTabTest.java

MainTableDataModelTest.javaAssert published results follow the latest search +4/-0

Assert published results follow the latest search

• Extends search tests to check the model's exposed matched entries, including when overlapping searches finish out of order.

jabgui/src/test/java/org/jabref/gui/maintable/MainTableDataModelTest.java

Documentation (2) +22 / -0
CHANGELOG.mdDocument the restored entry-editor results +1/-0

Document the restored entry-editor results

• Adds a release-note entry for linked-file full-text results missing from the entry editor.

CHANGELOG.md

search-within-library.mdAdd full-text requirements with an unresolved conflict +21/-0

Add full-text requirements with an unresolved conflict

• Adds an entry-editor results requirement and a case-sensitive linked-file search requirement. Git conflict markers remain around the existing lenient-query requirement and must be resolved.

docs/requirements/search-within-library.md

Other (1) +2 / -0
build.gradle.ktsMake Lucene available to GUI tests +2/-0

Make Lucene available to GUI tests

• Adds the Lucene core module to the GUI test module configuration for the new search-result test.

jabgui/build.gradle.kts

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Requirements retain merge-conflict markers ✓ Resolved
Description
search-within-library.md retains >>>>>> markers around competing requirement sections, splitting
the lenient-query-parsing heading instead of presenting a resolved document. Readers and generated
requirements pages encounter both branches' headings and cannot tell which requirement set is
authoritative.
Code

docs/requirements/search-within-library.md[R62-65]

+<<<<<<< HEAD
## Full-text search survives a query only Lucene rejects
+=======
+## Full-text search results must reflect the active library in the entry editor
Evidence
The requirements file contains an opening conflict marker, separator, and closing marker around
competing full-text search headings, including a split lenient-query-parsing heading. These markers
leave the requirements ambiguous and contradict the repository's instruction to remove conflict
markers before committing a merge.

AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn: AGENTS.md: Maintain compatibility and avoid unrelated code churn
docs/requirements/search-within-library.md[62-83]
docs/requirements/search-within-library.md[62-85]
AGENTS.md[480-483]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The search requirements document contains unresolved Git merge-conflict markers and competing branch content, leaving the requirements ambiguous.
## Fix Focus Areas
- docs/requirements/search-within-library.md[62-83]
## Recommended Fix
Resolve the conflict by removing all markers, retaining the intended requirements from both branches with each valid identifier and its associated text, and using one heading for the lenient-query-parsing requirement. Keep the existing markdownlint directive at the end of the file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Library switches erase full-text hits 🐞 Bug ≡ Correctness
Description
searchQueryListener clears the editor content on every active-query change without restoring
results already cached for the newly active library. When switching to a library whose own query and
results are already set, the active-tab change can render those hits first, then query
synchronization clears them without triggering another search-results update.
Code

jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java[96]

+        searchQueryListener = (_, _, _) -> content.getChildren().clear();
Evidence
The frame sets the active library before synchronizing its query. The editor rebuilds its tabs on
that first change, while the new query listener only clears content; the table model publishes
results when its per-library query changes, so an unchanged destination query supplies no later
event to redraw cached results.

jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java[449-466]
jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java[157-165]
jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditorViewModel.java[180-194]
jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java[96-114]
jabgui/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java[103-137]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Synchronizing the active query after a library switch can clear cached full-text hits without a subsequent results event to redraw them.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java[96-106]
- jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java[128-134]
## Recommended Fix
On query changes, refresh from the active library's cached results when they correspond to its current query; otherwise keep the view empty until the new search completes. Add a library-switch test where both libraries already have queries and completed results.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

setContentDrivenVisibility(contentVisibility);

content = new TextFlow();
searchQueryListener = (_, _, _) -> content.getChildren().clear();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remediation recommended

2. Library switches erase full-text hits 🐞 Bug ≡ Correctness

searchQueryListener clears the editor content on every active-query change without restoring
results already cached for the newly active library. When switching to a library whose own query and
results are already set, the active-tab change can render those hits first, then query
synchronization clears them without triggering another search-results update.
Agent Prompt
## Issue description
Synchronizing the active query after a library switch can clear cached full-text hits without a subsequent results event to redraw them.

## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java[96-106]
- jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FulltextSearchResultsTab.java[128-134]

## Recommended Fix
On query changes, refresh from the active library's cached results when they correspond to its current query; otherwise keep the view empty until the new search completes. Add a library-switch test where both libraries already have queries and completed results.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Codex Local Analysis added 2 commits October 26, 2026 22:11
* stable:
  docs: port requirements guidance to stable (#17576)

# Conflicts:
#	docs/requirements/search-within-library.md
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Oct 27, 2026
@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Oct 27, 2026
@Siedlerchr
Siedlerchr enabled auto-merge October 27, 2026 19:01
@Siedlerchr
Siedlerchr added this pull request to the merge queue Oct 27, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Oct 27, 2026
* upstream/stable:
  [Port to stable] Skip changelog consistency checks for stable port PRs (#17605)
@Siedlerchr
Siedlerchr removed this pull request from the merge queue due to a manual request Oct 27, 2026
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Oct 27, 2026
@koppor

koppor commented Oct 27, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code
Moved to JabRef#8: ports now target black-forest in that repository. Branch kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: entry-editor component: maintable dev: build-system size: medium status: changes-required Pull requests that are not yet complete status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants