Top Description Fields Constructors Methods
org.jabref.logic.importer.fetcher

public Class GoogleScholar

extends Object
implements FulltextFetcher, PagedSearchBasedFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.PagedSearchBasedFetcher, org.jabref.logic.importer.SearchBasedFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.FulltextFetcher
Imports
java.io.IOException, .StringReader, java.net.HttpCookie, .URISyntaxException, .URL, java.util.ArrayList, .Collection, .List, .Objects, .Optional, java.util.regex.Matcher, .Pattern, org.jabref.logic.help.HelpFile, org.jabref.logic.importer.FetcherException, .FulltextFetcher, .ImportFormatPreferences, .PagedSearchBasedFetcher, .ParserResult, org.jabref.logic.importer.fetcher.transformers.ScholarQueryTransformer, org.jabref.logic.importer.fileformat.BibtexParser, org.jabref.logic.l10n.Localization, org.jabref.logic.net.URLDownload, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.paging.Page, org.apache.hc.core5.net.URIBuilder, org.apache.lucene.queryparser.flexible.core.nodes.QueryNode, org.jsoup.Jsoup, org.jsoup.nodes.Document, org.jsoup.select.Elements, org.slf4j.Logger, .LoggerFactory

FulltextFetcher implementation that attempts to find a PDF URL at GoogleScholar.

Search String infos: https://scholar.google.com/intl/en/scholar/help.html#searching

Field Summary

Modifier and TypeField and Description
private static final String
private final ImportFormatPreferences
private static final Logger
private static final int

Constructor Summary

AccessConstructor and Description
public
GoogleScholar(ImportFormatPreferences importFormatPreferences)

Method Summary

Modifier and TypeMethod and Description
private void
addHitsFromQuery(List<BibEntry> entryList, String queryURL)

private BibEntry
public Optional<URL>
findFullText(BibEntry
The Bibtex entry
entry
)

Implements org.jabref.logic.importer.FulltextFetcher.findFullText.

Tries to find a fulltext URL for a given BibTex entry.

public Optional<HelpFile>
getHelpPage()

Overrides default org.jabref.logic.importer.WebFetcher.getHelpPage.

Returns the help page for this fetcher.

public String
getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher.

public TrustLevel
getTrustLevel()

Overrides default org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher.

private boolean
private void
public Page<BibEntry>
performSearchPaged(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
the root node of the lucene query
luceneQuery
,
int
requested site number indexed from 0
pageNumber
)

Implements org.jabref.logic.importer.PagedSearchBasedFetcher.performSearchPaged.

private Optional<URL>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASIC_SEARCH_URLback to summary
private static final String BASIC_SEARCH_URL
importFormatPreferencesback to summary
private final ImportFormatPreferences importFormatPreferences
LOGGERback to summary
private static final Logger LOGGER
NUM_RESULTSback to summary
private static final int NUM_RESULTS

Constructor Detail

GoogleScholarback to summary
public GoogleScholar(ImportFormatPreferences importFormatPreferences)

Method Detail

addHitsFromQueryback to summary
private void addHitsFromQuery(List<BibEntry> entryList, String queryURL) throws IOException, FetcherException
downloadEntryback to summary
private BibEntry downloadEntry(String link) throws IOException, FetcherException
findFullTextback to summary
public Optional<URL> findFullText(BibEntry entry) throws IOException, FetcherException

Implements org.jabref.logic.importer.FulltextFetcher.findFullText.

Doc from org.jabref.logic.importer.FulltextFetcher.findFullText.

Tries to find a fulltext URL for a given BibTex entry.

Parameters
entry:BibEntry

The Bibtex entry

Returns:Optional<URL>

The fulltext PDF URL Optional, if found, or an empty Optional if not found.

Annotations
@Override
Exceptions
IOException:
if an IO operation has failed
FetcherException:
if a fetcher specific error occurred
getHelpPageback to summary
public Optional<HelpFile> getHelpPage()

Overrides default org.jabref.logic.importer.WebFetcher.getHelpPage.

Doc from org.jabref.logic.importer.WebFetcher.getHelpPage.

Returns the help page for this fetcher.

Returns:Optional<HelpFile>

the HelpFile enum constant for the help page

Annotations
@Override
getNameback to summary
public String getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Doc from org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher. The title can be used to display the fetcher in the menu and in the side pane.

Returns:String

the localized name

Annotations
@Override
getTrustLevelback to summary
public TrustLevel getTrustLevel()

Overrides default org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Doc from org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher. We distinguish between publishers and meta search engines for example.

Returns:TrustLevel

The trust level of the fetcher, the higher the better

Annotations
@Override
needsCaptchaback to summary
private boolean needsCaptcha(String body)
obtainAndModifyCookieback to summary
private void obtainAndModifyCookie() throws FetcherException
performSearchPagedback to summary
public Page<BibEntry> performSearchPaged(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode luceneQuery, int pageNumber) throws FetcherException

Implements org.jabref.logic.importer.PagedSearchBasedFetcher.performSearchPaged.

Parameters
luceneQuery:org.apache.lucene.queryparser.flexible.core.nodes.QueryNode

Doc from org.jabref.logic.importer.PagedSearchBasedFetcher.performSearchPaged.

the root node of the lucene query

pageNumber:int

Doc from org.jabref.logic.importer.PagedSearchBasedFetcher.performSearchPaged.

requested site number indexed from 0

Returns:Page<BibEntry>

Doc from org.jabref.logic.importer.PagedSearchBasedFetcher.performSearchPaged.

Page with search results

Annotations
@Override
searchback to summary
private Optional<URL> search(String url) throws IOException