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

public Class ComplexSearchQuery

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collection, .List, .Objects, .Optional, .StringJoiner, org.jabref.model.strings.StringUtil, org.apache.lucene.index.Term

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final List<String>
private final List<String>
private final List<String>
private final String
private final Integer
private final String
private final Integer
private final List<String>
private final Integer

Constructor Summary

AccessConstructor and Description
private
ComplexSearchQuery(List<String> defaultField, List<String> authors, List<String> titlePhrases, List<String> abstractPhrases, Integer fromYear, Integer toYear, Integer singleYear, String journal, String doi)

Method Summary

Modifier and TypeMethod and Description
public static ComplexSearchQuery.ComplexSearchQueryBuilder
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static ComplexSearchQuery
fromTerms(List<org.apache.lucene.index.Term> terms)

public List<String>
public List<String>
public List<String>
public Optional<String>
public Optional<Integer>
public Optional<String>
public Optional<Integer>
public List<String>
public Optional<Integer>
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

abstractPhrasesback to summary
private final List<String> abstractPhrases
authorsback to summary
private final List<String> authors
defaultFieldback to summary
private final List<String> defaultField
doiback to summary
private final String doi
fromYearback to summary
private final Integer fromYear
journalback to summary
private final String journal
singleYearback to summary
private final Integer singleYear
titlePhrasesback to summary
private final List<String> titlePhrases
toYearback to summary
private final Integer toYear

Constructor Detail

ComplexSearchQueryback to summary
private ComplexSearchQuery(List<String> defaultField, List<String> authors, List<String> titlePhrases, List<String> abstractPhrases, Integer fromYear, Integer toYear, Integer singleYear, String journal, String doi)

Method Detail

builderback to summary
public static ComplexSearchQuery.ComplexSearchQueryBuilder builder()
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
fromTermsback to summary
public static ComplexSearchQuery fromTerms(List<org.apache.lucene.index.Term> terms)
getAbstractPhrasesback to summary
public List<String> getAbstractPhrases()
getAuthorsback to summary
public List<String> getAuthors()
getDefaultFieldPhrasesback to summary
public List<String> getDefaultFieldPhrases()
getDOIback to summary
public Optional<String> getDOI()
getFromYearback to summary
public Optional<Integer> getFromYear()
getJournalback to summary
public Optional<String> getJournal()
getSingleYearback to summary
public Optional<Integer> getSingleYear()
getTitlePhrasesback to summary
public List<String> getTitlePhrases()
getToYearback to summary
public Optional<Integer> getToYear()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.jabref.logic.importer.fetcher back to summary

public Class ComplexSearchQuery.ComplexSearchQueryBuilder

extends Object
Class Inheritance
  • java.lang.Object
  • org.jabref.logic.importer.fetcher.ComplexSearchQuery.ComplexSearchQueryBuilder

Field Summary

Modifier and TypeField and Description
private final List<String>
private final List<String>
private final List<String>
private String
private Integer
private String
private Integer
private final List<String>
private Integer

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ComplexSearchQuery.ComplexSearchQueryBuilder
abstractPhrase(String abstractPhrase)

Adds abstract phrase and wraps it in quotes

public ComplexSearchQuery.ComplexSearchQueryBuilder
author(String author)

Adds author and wraps it in quotes

public ComplexSearchQuery

Returns:

ComplexSearchQuery instance with the fields set to the values defined in the building instance.
build
()

Instantiates the AdvancesSearchConfig from the provided Builder parameters If all text fields are empty an empty optional is returned

public ComplexSearchQuery.ComplexSearchQueryBuilder
defaultFieldPhrase(String defaultFieldPhrase)

public ComplexSearchQuery.ComplexSearchQueryBuilder
DOI(String doi)

public ComplexSearchQuery.ComplexSearchQueryBuilder
fromYearAndToYear(Integer fromYear, Integer toYear)

public ComplexSearchQuery.ComplexSearchQueryBuilder
journal(String journal)

pack-priv void
public ComplexSearchQuery.ComplexSearchQueryBuilder
singleYear(Integer singleYear)

private boolean
public ComplexSearchQuery.ComplexSearchQueryBuilder
terms(Collection<org.apache.lucene.index.Term> terms)

private boolean
public ComplexSearchQuery.ComplexSearchQueryBuilder
titlePhrase(String titlePhrase)

Adds title phrase and wraps it in quotes

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abstractPhrasesback to summary
private final List<String> abstractPhrases
authorsback to summary
private final List<String> authors
defaultFieldPhrasesback to summary
private final List<String> defaultFieldPhrases
doiback to summary
private String doi
fromYearback to summary
private Integer fromYear
journalback to summary
private String journal
singleYearback to summary
private Integer singleYear
titlePhrasesback to summary
private final List<String> titlePhrases
toYearback to summary
private Integer toYear

Constructor Detail

ComplexSearchQueryBuilderback to summary
private ComplexSearchQueryBuilder()

Method Detail

abstractPhraseback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder abstractPhrase(String abstractPhrase)

Adds abstract phrase and wraps it in quotes

authorback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder author(String author)

Adds author and wraps it in quotes

buildback to summary
public ComplexSearchQuery build() throws IllegalStateException

Instantiates the AdvancesSearchConfig from the provided Builder parameters If all text fields are empty an empty optional is returned

Returns:ComplexSearchQuery

ComplexSearchQuery instance with the fields set to the values defined in the building instance.

Exceptions
IllegalStateException:
An IllegalStateException is thrown in case all text search fields are empty. See: https://softwareengineering.stackexchange.com/questions/241309/builder-pattern-when-to-fail/241320#241320
defaultFieldPhraseback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder defaultFieldPhrase(String defaultFieldPhrase)
DOIback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder DOI(String doi)
fromYearAndToYearback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder fromYearAndToYear(Integer fromYear, Integer toYear)
journalback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder journal(String journal)
parseYearRangeback to summary
pack-priv void parseYearRange(String termText)
singleYearback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder singleYear(Integer singleYear)
stringListIsBlankback to summary
private boolean stringListIsBlank(List<String> stringList)
termsback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder terms(Collection<org.apache.lucene.index.Term> terms)
textSearchFieldsAndYearFieldsAreEmptyback to summary
private boolean textSearchFieldsAndYearFieldsAreEmpty()
titlePhraseback to summary
public ComplexSearchQuery.ComplexSearchQueryBuilder titlePhrase(String titlePhrase)

Adds title phrase and wraps it in quotes

yearFieldsAreEmptyback to summary
private boolean yearFieldsAreEmpty()