Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsQuery ¶ added in v0.2.0
IsQuery is a very simple determination if a string looks like a faceted search query. If the string starts with low-case letters following a colon, the string is considered to be a query.
Such a simple method is used, because neither scientific names or files normally have such pattern at th start of their string.
Types ¶
type Input ¶
type Input struct {
// Query field contains the query of the faceted search.
//
// Example: `g:Bubo sp:bubo a:Linn. yr:1700-1800`
Query string `json:"query,omitempty"`
// DataSourceID field contains data-source ID for ParentTaxon and
// serves as a preferred data-source in the final search results.
DataSources []int `json:"dataSources,omitempty"`
// WithAllMatches field indicates if all found data should be provided by the
// output, or only the "best result".
WithAllMatches bool `json:"withAllMatches,omitempty"`
// ParentTaxon creates a filter to return only results that have the
// required taxon in their classification path. The field uses the first
// ID from DataSourceIDs.
ParentTaxon string `json:"parentTaxon,omitempty"`
// NameString is a convenience field. It allows to provide faceted search
// data as a freeform 'name-string' input. The name-string does not have
// to be a 'real name', and it suppose to have only one component of each
// kind. For example it should contain one infraspecific epithet, and
// one author. If it has more, a warning will be generated and only one
// of the values of a ducplicated category will be used.
//
// For example: `Aus bus cus A. 1888`.
//
// If NameString is given, all other inputs for genus, species,
// authors, year will be ignored.
NameString string `json:"nameString,omitempty"`
// Genus field creates a faceted search filter by a genus name. The name
// can be abbreviated up to one character following a period.
//
// For example: `H.`, `Hom.`, `Homo`.
Genus string `json:"genus,omitempty"`
// SpeciesAny field creates a faceted search filter for either specific or
// infraspecific epithets. If SpeciesAny is given Species and SpeciesInfra
// fields are ignored.
SpeciesAny string `json:"speciesAny,omitempty"`
// Species field creates a faceted search filter for specific epithet only.
Species string `json:"species,omitempty"`
// SpecieInfra field creates a faceted search filter for infraspecific
// epithets. Such epithets can be subspecies, varieties, formas etc.
SpeciesInfra string `json:"speciesInfra,omitempty"`
// Author field creates a faceted search filter for Author name. This
// field can be abbreviated up to one letter folloing period character.
//
// For example: `L.`, `Linn.`, `Linnaeus`.
Author string `json:"author,omitempty"`
// Year field creates a faceted search filter for a year.
Year int `json:"year,omitempty"`
// YearRange field creates a more flexible filter for year data.
//
// Example:
// 1990-1995: year >= 1990 && year =< 1995
// 1990-: year >= 1990
// -1995: year <= 1995
*YearRange `json:"yearRange,omitempty"`
// Tail field keeps a non-parsed pard of a query, in case if full parsing
// of query string did fail.
Tail string `json:"unparsedTail,omitempty"`
// Warnings field contains warnings generated by a parsing process.
Warnings []string `json:"warnings,omitempty"`
}
Input contains data needed for creating a faceted search query by GNames.
type YearRange ¶ added in v0.1.3
type YearRange struct {
// YearStart is the smaller year of the range.
// YearEnd is the larger year of the range.
YearStart, YearEnd int
}
YearRange field creates a more flexible filter for year data.
Example: 1990-1995: year >= 1990 && year =< 1995 1990-: year >= 1990 -1995: year <= 1995
Click to show internal directories.
Click to hide internal directories.