Skip to content

Send accented search terms to arXiv unchanged - #16771

Closed
Pranav-error wants to merge 1 commit into
JabRef:mainfrom
Pranav-error:arxiv-accented-search
Closed

Pranav-error wants to merge 1 commit into
JabRef:mainfrom
Pranav-error:arxiv-accented-search

Conversation

@Pranav-error

@Pranav-error Pranav-error commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

ArXivFetcher.callApi stripped accents from the search query, with the comment "The arXiv API has problems with accents, so we remove them (i.e. Fréchet -> Frechet)". That is no longer true, and the workaround now guarantees zero results for any accented search — arXiv matches only the accented form:

what is sent results from export.arxiv.org
ti:"slice theorem for Fr%C3%A9chet" (UTF-8) 1
ti:"slice theorem for Frechet" (what JabRef sent) 0
Fr%E9chet (Latin-1) 0

URIBuilder already percent-encodes the parameter as UTF-8, so passing the query through unchanged is enough.

The other two stripAccents calls in this file are deliberately untouched: buildBroadTitleQuery skips accented terms when assembling the broad fallback query, and normalizeForTitleMatching normalises for comparison rather than for the request.

Steps to test

./gradlew :jablib:fetcherTest --tests "*ArXivFetcherTest*"

searchEntryByPartOfTitleWithAcuteAccent currently fails on main with expected: <[...]> but was: <[]> — the search returns nothing at all. With this change it returns the correct paper.

It does not yet make that test green, and I would rather say so than hide it. After this fix the assertion fails on one remaining field, the citation key:

  • expected @article{Diez:2013fdp,
  • actual @article{https://doi.org/10.48550/arxiv.1405.2249,

That is a second, independent problem in infuseWithInspireCitationKeyIfMissing, not something this change introduces — before it, the search returned an empty list, so the key path was never exercised. INSPIRE still serves the expected key (GET /api/arxiv/1405.2249?fields=texkeys["Diez:2013fdp", "Diez:2014ppa"]), and INSPIREFetcherTest passes 3/3, so the fetcher itself is healthy — the lookup from ArXivFetcher is what comes back empty, and its FetcherClientException branch logs at TRACE, so it fails silently.

Happy to chase that in this PR or a separate one, whichever you prefer. I did not want to bundle a guess at it with a fix I can actually demonstrate.

Related issues and pull requests

Closes #16772

AI usage

Claude Code (model claude-opus-5), used to run the fetcher test task, read the failure report, and check the arXiv and INSPIRE APIs directly. AIL3 — AI-assisted, human-directed and human-owned.

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • I added one sentence (max 20 words) to CHANGELOG.md describing the change from the user's point of view (if the change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

callApi stripped accents from the query, with a comment saying the arXiv
API had problems with them. That is no longer true, and the workaround now
guarantees zero results for any accented search: arXiv returns one match
for ti:"slice theorem for Fréchet" and none for the stripped form.

The other two stripAccents calls are untouched. One skips accented terms
when building the broad fallback query, the other normalises titles for
comparison rather than for the request.
Copilot AI lite review requested due to automatic review settings August 31, 2026 16:58

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Preserve accented terms in arXiv search queries

🐞 Bug fix 📝 Documentation 🕐 Less than 10 minutes

Grey Divider

AI Description

• Sends accented arXiv search terms unchanged so exact accented titles return results.
• Relies on URIBuilder's UTF-8 encoding instead of destructive accent stripping.
• Corrects DOI documentation links and removes an empty documentation line.
Diagram

sequenceDiagram
    actor Caller as Search Caller
    participant Fetcher as ArXiv Fetcher
    participant Builder as URI Builder
    participant API as arXiv API
    Caller->>Fetcher: Search accented title
    Fetcher->>Builder: Add unchanged query
    Builder-->>Fetcher: UTF-8 encoded URL
    Fetcher->>API: GET encoded query
    API-->>Fetcher: Return matching entries
Loading
High-Level Assessment

Passing the original query to URIBuilder is the appropriate approach because it preserves arXiv's accent-sensitive semantics while reusing established UTF-8 percent encoding. Manual encoding or conditional accent handling would duplicate URIBuilder behavior and risk malformed or inconsistent requests; the separate fallback-query and title-comparison normalization paths should remain unchanged.

Files changed (1) +5 / -7

Bug fix (1) +5 / -7
ArXivFetcher.javaPreserve accents in arXiv API search parameters +5/-7

Preserve accents in arXiv API search parameters

• Stops removing diacritics from 'search_query', allowing arXiv to match accent-sensitive titles while URIBuilder handles UTF-8 encoding. Also converts DOI references in documentation to valid Javadoc links and removes an empty documentation marker.

jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java

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

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (3) 📜 Skill insights (0)

Grey Divider


Action required

1. Legacy links in Markdown Javadoc 📘 Rule violation ⚙ Maintainability
Description
The changed /// documentation introduces legacy {@link ...} tags instead of Markdown links. This
directly violates the required Markdown Javadoc syntax.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[175]

+    /// {@link #DOI_PREFIX} + the entry's ArXiv ID
Evidence
PR Compliance ID 8 requires changed multiline Java documentation to use /// with Markdown
constructs rather than legacy inline tags. The cited changed lines place {@link ...} inside ///
comments.

AGENTS.md: Use Markdown Javadoc Syntax for Multiline Documentation Comments
jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[175-175]
jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[185-185]
jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[203-203]
jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[222-222]

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

## Issue description
Changed `///` documentation uses legacy `{@link ...}` syntax instead of Markdown Javadoc links.

## Issue Context
Use Markdown links such as `[#DOI_PREFIX]` and `[#getAutomaticDoi(ArXivIdentifier)]` consistently in all four changed documentation lines.

## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[175-175]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[185-185]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[203-203]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[222-222]

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


2. Accent fix lacks passing test 📘 Rule violation ☼ Reliability
Description
The logic change has no corresponding test change, and the existing accented-title integration test
still cannot pass because it compares against a citation key the current path does not return.
Consequently, the new request behavior is not protected by a green regression test.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[602]

+                uriBuilder.addParameter("search_query", searchQuery);
Evidence
PR Compliance IDs 19 and 20 require logic behavior changes to include effective, passing regression
coverage. Line 602 changes the outgoing search term, while the unchanged test at lines 308-310
compares the whole result against a fixture whose citation key is fixed at line 123; as documented
by the PR, that assertion remains failing after this change.

AGENTS.md: Update Model and Logic Tests When Their Behavior Changes
AGENTS.md: Add Fast, Deterministic Tests for Behavioral Changes Without Weakening Coverage
jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[601-602]
jablib/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java[308-310]
jablib/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java[110-124]

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 changed arXiv query behavior lacks a corresponding passing regression test.

## Issue Context
The existing live test searches for `Fréchet`, but its full-entry expectation includes `Diez:2013fdp`; the PR description confirms the current result instead receives a DOI-based key. Add or adapt coverage so the accented query behavior is verified by a green, deterministic-enough live endpoint test without weakening unrelated assertions or mocking arXiv.

## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[601-602]
- jablib/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java[308-310]
- jablib/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java[110-124]

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


3. Accented search fix undocumented 📘 Rule violation ⚙ Maintainability
Description
Passing accented queries unchanged restores user-visible arXiv search results, but this PR adds no
entry under UnreleasedFixed. The missing changelog entry violates the required user-facing
release documentation.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[602]

+                uriBuilder.addParameter("search_query", searchQuery);
Evidence
PR Compliance ID 30 requires a user-visible fix to have a concise entry in the matching Unreleased
section. The source change at line 602 restores accented arXiv searches, while the current
UnreleasedFixed section contains no corresponding entry.

AGENTS.md: Maintain User-Focused CHANGELOG Entries Only for User-Visible Changes
jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[602-602]
CHANGELOG.md[104-110]

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 user-visible accented arXiv search fix is missing from the unreleased changelog.

## Issue Context
Add one sentence of at most 20 words under `Unreleased` → `Fixed`, beginning with `We fixed` and describing only the user-visible result. Link the relevant issue if one exists; otherwise use the permitted TODO fallback rather than inventing an issue number.

## Fix Focus Areas
- CHANGELOG.md[104-110]

ⓘ 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 type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

/// <br/><br/>
/// ArXiv-issued DOIs are identifiers associated with every ArXiv entry. They are composed of a fixed
/// [#DOI_PREFIX] + the entry's ArXiv ID
/// {@link #DOI_PREFIX} + the entry's ArXiv ID

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.

Action required

1. Legacy links in markdown javadoc 📘 Rule violation ⚙ Maintainability

The changed /// documentation introduces legacy {@link ...} tags instead of Markdown links. This
directly violates the required Markdown Javadoc syntax.
Agent Prompt
## Issue description
Changed `///` documentation uses legacy `{@link ...}` syntax instead of Markdown Javadoc links.

## Issue Context
Use Markdown links such as `[#DOI_PREFIX]` and `[#getAutomaticDoi(ArXivIdentifier)]` consistently in all four changed documentation lines.

## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[175-175]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[185-185]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[203-203]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[222-222]

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

// The arXiv API has problems with accents, so we remove them (i.e. Fréchet -> Frechet)
if (StringUtil.isNotBlank(searchQuery)) {
uriBuilder.addParameter("search_query", StringUtil.stripAccents(searchQuery));
uriBuilder.addParameter("search_query", searchQuery);

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.

Action required

2. Accent fix lacks passing test 📘 Rule violation ☼ Reliability

The logic change has no corresponding test change, and the existing accented-title integration test
still cannot pass because it compares against a citation key the current path does not return.
Consequently, the new request behavior is not protected by a green regression test.
Agent Prompt
## Issue description
The changed arXiv query behavior lacks a corresponding passing regression test.

## Issue Context
The existing live test searches for `Fréchet`, but its full-entry expectation includes `Diez:2013fdp`; the PR description confirms the current result instead receives a DOI-based key. Add or adapt coverage so the accented query behavior is verified by a green, deterministic-enough live endpoint test without weakening unrelated assertions or mocking arXiv.

## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/ArXivFetcher.java[601-602]
- jablib/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java[308-310]
- jablib/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java[110-124]

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

// The arXiv API has problems with accents, so we remove them (i.e. Fréchet -> Frechet)
if (StringUtil.isNotBlank(searchQuery)) {
uriBuilder.addParameter("search_query", StringUtil.stripAccents(searchQuery));
uriBuilder.addParameter("search_query", searchQuery);

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.

Action required

3. Accented search fix undocumented 📘 Rule violation ⚙ Maintainability

Passing accented queries unchanged restores user-visible arXiv search results, but this PR adds no
entry under UnreleasedFixed. The missing changelog entry violates the required user-facing
release documentation.
Agent Prompt
## Issue description
The user-visible accented arXiv search fix is missing from the unreleased changelog.

## Issue Context
Add one sentence of at most 20 words under `Unreleased` → `Fixed`, beginning with `We fixed` and describing only the user-visible result. Link the relevant issue if one exists; otherwise use the permitted TODO fallback rather than inventing an issue number.

## Fix Focus Areas
- CHANGELOG.md[104-110]

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

@koppor koppor left a comment

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.

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Aug 31, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge upstream/main with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

@Pranav-error

Copy link
Copy Markdown
Contributor Author

Fair enough — closing this. The bug and the evidence are in #16772; happy for anyone to take it from there, or I'll reopen a PR written properly.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This pull requests was closed without merging. You have been unassigned from the respective issue #16772. In case you closed the PR for yourself, you can re-open it. Please also check After submission of a pull request in CONTRIBUTING.md.

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

Labels

component: fetcher status: changes-required Pull requests that are not yet complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arXiv search returns nothing for terms with accented characters

3 participants