Skip to content

feat(fetcher): implement SearchBasedFetcher for ScienceDirect using scopus search API#14551

Merged
koppor merged 25 commits intoJabRef:mainfrom
Siva-Sai22:fix/#14421
Jan 23, 2026
Merged

feat(fetcher): implement SearchBasedFetcher for ScienceDirect using scopus search API#14551
koppor merged 25 commits intoJabRef:mainfrom
Siva-Sai22:fix/#14421

Conversation

@Siva-Sai22
Copy link
Copy Markdown
Contributor

@Siva-Sai22 Siva-Sai22 commented Dec 8, 2025

Closes #14421

Implemented web search capability for ScienceDirect by integrating the Scopus Search API, since the ScienceDirect Search API requires institutional access that most users don't have. Added a new ScopusQueryTransformer to convert JabRef search queries to Scopus query syntax, and wrote the Scopus class to implement PagedSearchBasedParserFetcher interface, enabling paginated search results with proper JSON response parsing, this allows users to search academic literature via the "Web search" feature in JabRef, which was previously not available for ScienceDirect.
Modified the ScienceDirect to use the api key of scopus.

Steps to test

  • Go to settings -> preferences -> websearch.
  • Add the Scopus API key and test it.
  • Then search using the Scopus (Example query: author = Einstein)
Screenshot_20251220_002434 Screenshot_20251220_002153

Mandatory checks

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 8, 2025

Hey @Siva-Sai22! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs.

Please re-check our AI Usage Policy to ensure that your pull request is in line with it. It also contains links to our contribution guide in case of any other doubts related to our contribution workflow.

@Siva-Sai22 Siva-Sai22 changed the title Fix/#14421 feat(fetcher): implement SearchBasedFetcher for ScienceDirect using scopus search API Dec 8, 2025
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete labels Dec 8, 2025
Copy link
Copy Markdown
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

According to https://dev.elsevier.com/technical_documentation.html Scopus is not ScienceDirect.

I see two options:

  1. To avoid confusion, ScienceDirect should be renamed to Elsevier. But then, we have a "big ball of mud", because the methods in that class are not coupled, but only semnatically correlated
  2. Add new functionality to Scopus - this should make maintainence easier. This fetcher should be added to the list of fetchers in the "Web Search" prefernces

Please do option 2 to have the fetcher class small.

  • API key should renamed from "Scopus" to "Esevier", since it covers both.

Future work: Split up API key configuration and fetcher enablement.

grafik

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 8, 2025
Siedlerchr
Siedlerchr previously approved these changes Dec 8, 2025
@Siedlerchr Siedlerchr added status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers and removed status: changes-required Pull requests that are not yet complete labels Dec 8, 2025
Comment on lines +227 to +231
String response = new BufferedReader(new InputStreamReader(inputStream))
.lines()
.collect(Collectors.joining(OS.NEWLINE));

JSONObject jsonObject = new JSONObject(response);
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.

There must be a method to convert an inputstream to a JSON object directly. But maybe, not mit dem JSONObject.

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.

** JSONObject response = JsonReader.toJsonObject(inputStream);
**

@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 8, 2025

Another view - from

grafik

@koppor koppor added status: changes-required Pull requests that are not yet complete and removed status: devcall status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Dec 8, 2025
@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

Siva-Sai22 commented Dec 9, 2025

  • API key should renamed from "Scopus" to "Esevier", since it covers both.

@koppor
But the ScienceDirect is accessing the api key using the FETCHER_NAME (ScienceDirect). If we rename it to Esevier we have to change the fetcher name also
importerPreferences.getApiKey(getName())

I think it would be better to take a scopus api key also.

@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 11, 2025

  • API key should renamed from "Scopus" to "Esevier", since it covers both.

@koppor But the ScienceDirect is accessing the api key using the FETCHER_NAME (ScienceDirect). If we rename it to Esevier we have to change the fetcher name also importerPreferences.getApiKey(getName())

I think it would be better to take a scopus api key also.

I searched for the code you gave

image

It seems that EACH FETCHER uses that thing.

Since the new fetcher is a SearchBasedFetcher displayed in the preferences, the old fetcher should use the key of the other fetcher. With that, both fetchers will share the same key and it can be configured.

Update That means, my idea with "Elsevier" was wrong and a concrete fetcher name is used. -- Please double check with the preferences code.

@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

@koppor I have checked the preferences code
The api key is stored in a keyring and retrieved using the same when called using the concrete fetcher name
So I think we can't have the same api key name for the two different fetchers.

I have changes in which we allow the user to input the api key for scopus (same as the scienceDirect one) and can display the search results.

If you are okay with this approach I will update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge 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.

@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 17, 2025

@Siva-Sai22 It is difficult for me to follow. Please provide a link (you can search for files on GitHub by typing T). Provide a deep link to the line number. - It is also OK to provide a class name and line number. Answers might then even take longer, since we mostly do JabRef during the day in short breaks without an IDE opened.

@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 17, 2025

I have changes in which we allow the user to input the api key for scopus (same as the scienceDirect one) and can display the search results.

No, this is not OK, because it seems that only one fetcher is displayed and not the other one.


To move on, you extract your new SearchBasedFetcher out and revert the original class to their own state. Then we maybe see easier how the key handling works.

@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

Siva-Sai22 commented Dec 18, 2025

@koppor

So the keys are fetched using the fetcher name.
The method you discussed above:

API key should renamed from "Scopus" to "Esevier", since it covers both.

This cannot be done because the api key is fetched using fetcher name.

As suggested by you the scienceDirect should be kept as it is (and not make it a search based fetcher) and instead make a new searchbasedfetcher known as Scopus which uses the Esevier's api for searching.

The scienceDirect and this scopus one will use the same api key. But inorder to use these the user has to put in the same api key twice (one for using scienceDirect which is fulltextFetcher (not modified) and one for the new Scopus which is searchBasedFetcher)

These are the changes : main...Siva-Sai22:jabref:test

@koppor koppor added status: waiting-for-feedback The submitter or other users need to provide more information about the issue and removed status: changes-required Pull requests that are not yet complete labels Dec 18, 2025
@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 19, 2025
@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 19, 2025

@Siva-Sai22 I seee that the class ScienceDirect itself calls the api key. One can replace getName() by Elsevier.

@koppor koppor added 📌 Pinned and removed status: waiting-for-feedback The submitter or other users need to provide more information about the issue labels Dec 19, 2025
@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

@koppor updated the pr with required changes. Please let me know if any other changes are required.

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 29, 2025
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete labels Dec 31, 2025
koppor
koppor previously approved these changes Jan 19, 2026
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Jan 19, 2026
public final String ieeeAPIKey;
public final String medlineApiKey;
public final String scienceDirectApiKey;
public final String scopusApiKey;
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.

I accept that we missed the alphabetical ordering here.

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Jan 19, 2026
@koppor
Copy link
Copy Markdown
Member

koppor commented Jan 19, 2026

[ant:checkstyle] [ERROR] /home/runner/work/jabref/jabref/jablib/src/test/java/org/jabref/logic/importer/fetcher/ScopusTest.java:27:15: Unused import - org.junit.jupiter.api.Assertions.assertFalse. [UnusedImports]

@koppor koppor removed the request for review from Siedlerchr January 20, 2026 14:33
koppor
koppor previously approved these changes Jan 20, 2026
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Jan 20, 2026
@koppor koppor enabled auto-merge January 23, 2026 08:33
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete labels Jan 23, 2026
@koppor koppor added this pull request to the merge queue Jan 23, 2026
Merged via the queue into JabRef:main with commit 9347580 Jan 23, 2026
54 checks passed
@Siva-Sai22 Siva-Sai22 deleted the fix/#14421 branch February 7, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: fetcher first contrib good second issue Issues that involve a tour of two or three interweaved components in JabRef 📌 Pinned

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make ScienceDirect a SearchBasedFetcher to be able to use an API key in the UI

4 participants