search

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2021 License: MIT Imports: 7 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canonical added in v0.1.4

type Canonical struct {
	ID               string                 `json:"id"`
	Name             string                 `json:"name"`
	MatchType        string                 `json:"matchType"`
	BestResult       *verifier.ResultData   `json:"bestResult,omitempty"`
	PreferredResults []*verifier.ResultData `json:"preferredResults,omitempty"`
}

type Input

type Input struct {
	// Query field keep the search query parsed to form the input structure.
	Query string `json:"input,omitempty"`

	// Warnings field contains warnings generated by a parsing process.
	Warnings []string `json:"warnings,omitempty"`

	// DataSourceID field contains data-source ID for ParentTaxon and
	// serves as a preferred data-source in the final search results.
	DataSourceID int `json:"dataSourceID,omitempty"`

	// ParentTaxon creates a filter to return only results that have the
	// required taxon in their classification path. The field uses DataSourceID
	// to get information which data-source to use. If none is set, it will
	// use Catalogue of Life (ID = 1).
	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:"tail,omitempty"`
}

Input contains data needed for creating a faceted search query by GNames.

func (Input) ProcessName

func (q Input) ProcessName() Input

ProcessName checks if NameString is given in the Input object. If yes, it cleans up redundant fields and populates data from a parsed name-string.

func (Input) ToQuery added in v0.1.1

func (q Input) ToQuery() string

type Meta added in v0.1.4

type Meta struct {
	Input
}

type Output added in v0.1.4

type Output struct {
	Meta    `json:"metadata"`
	Results []Canonical `json:"results,omitempty"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL