Documentation ¶
Overview ¶
Package search provides generic functionality to query the hub3 Linked-Open-Data store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidPage = errors.New("invalid page range requested")
)
Functions ¶
This section is empty.
Types ¶
type BreadCrumb ¶
type BreadCrumb struct { Href string `json:"href,omitempty"` Display string `json:"display,omitempty"` Field Label `json:"field,omitempty"` LocalizedField string `json:"localized_field,omitempty"` Value string `json:"value,omitempty"` IsLast bool `json:"is_last,omitempty"` }
BreadCrumb is a building block for displaying search and additional filtering. Each next step of filtering is an additional BreadCrumb.
type BreadCrumbBuilder ¶
type BreadCrumbBuilder struct {
// contains filtered or unexported fields
}
BreadCrumbBuilder holds all the information to build a search breadcrumb trail.
func (*BreadCrumbBuilder) BreadCrumbs ¶ added in v0.3.0
func (bcb *BreadCrumbBuilder) BreadCrumbs() []*BreadCrumb
BreadCrumbs returns a list of BreadCrumb.
func (*BreadCrumbBuilder) GetLast ¶
func (bcb *BreadCrumbBuilder) GetLast() *BreadCrumb
GetLast returns the last BreadCrumb from the trail
func (*BreadCrumbBuilder) GetPath ¶
func (bcb *BreadCrumbBuilder) GetPath() string
GetPath returns the path for the BreadCrumb
type ContextFilter ¶
type ContextFilter struct { SearchLabel string `json:"SearchLabel,omitempty"` TypeClass string `json:"TypeClass,omitempty"` }
ContextFilter is used to specify the path to filter the nested resources. TypeClass is optional and can be used to specify the RDF class of the resource.
type Facet ¶
type Facet struct { Name string `json:"name"` Field string `json:"field"` IsSelected bool `json:"isSelected"` I18n string `json:"i18N,omitempty"` Total int64 `json:"total"` MissingDocs int64 `json:"missingDocs"` OtherDocs int64 `json:"otherDocs"` Min string `json:"min,omitempty"` Max string `json:"max,omitempty"` Type string `json:"type,omitempty"` Links []*FacetLink `json:"links"` }
Facet is used in the search response to render Facet information.
type FacetField ¶
type FacetField struct { Field string Size int Type FacetType // contains filtered or unexported fields }
FacetField configures aggregrations for fields in the search response.
type FacetLink ¶
type FacetLink struct { URL string `json:"url"` IsSelected bool `json:"isSelected"` Value string `json:"value"` DisplayString string `json:"displayString"` Count int64 `json:"count"` }
FacetLink is used to build filter URIs in the search response.
type Filter ¶
type Filter struct { // SearchLabel is a short namespaced version of a URI. Field string `json:"searchLabel,omitempty"` Value string `json:"value,omitempty"` }
Filter is used to limit the results of a SearchRequest.
It supports both first level objects such as 'Meta' and 'Tree' and nested items from resource.entries via a NestedFilter.
type Label ¶
type Label string
Label is a namespaced representation of an URI to be used for query fields in the Hub3 search-index.
type NestedFilter ¶
type NestedFilter struct { }
NestedFilter is used to filter in the nested RDF structure of the RecordGraph.
type OptionFunc ¶
OptionFunc is a function that configures a Service. It is used in NewService.
func ResponseSize ¶
func ResponseSize(size int) OptionFunc
ResponseSize sets the default number of results returned in the Response.
type Paginator ¶ added in v0.2.1
type Paginator struct { Start int `json:"start"` // start is 1 based Rows int `json:"rows"` NumFound int `json:"numFound"` FirstPage int `json:"firstPage"` LastPage int `json:"lastPage"` CurrentPage int `json:"currentPage"` HasNext bool `json:"hasNext"` HasPrevious bool `json:"hasPrevious"` NextPageNumber int `json:"nextPageNumber"` PreviousPageNumber int `json:"previousPageNumber"` NextPage int `json:"nextPage"` PreviousPage int `json:"previousPage"` Links []PageLink `json:"links"` // When backend has a hard limit like ElasticSearch for paging you can // set a max here and it will return an error when it is exceeded. MaxPagingWindow int `json:"-"` }
func NewPaginator ¶ added in v0.2.1
NewPaginator creates a Paginator without PageLinks. You need to call AddPageLinks() to add them to the Paginator. Cursor is zero-based. If page is not zero, the cursor value is ignored
func (*Paginator) AddPageLinks ¶ added in v0.2.1
type Param ¶
type Param struct { // Key is used to match the query param Key []string }
Param are self-documenting query parameters for search requests.
type ScrollPager ¶
type ScrollPager struct { // scrollID is serialized version SearchRequest ScrollID string `json:"scrollID"` Cursor int32 `json:"cursor"` Total int64 `json:"total"` Rows int32 `json:"rows"` }
ScrollPager holds all paging information for a search result.
func NewScrollPager ¶
func NewScrollPager() ScrollPager
NewScrollPager returns a ScrollPager with defaults set
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the central search service that should be initialized once and shared between requests. It is safe for concurrent use by multiple goroutines.
func NewService ¶
func NewService(options ...OptionFunc) (*Service, error)
NewService creates a new Service to query the Hub3 search-index.
NewService, by default, is meant to be long-lived and shared across your application.
The caller can configure the new service by passing configuration options to the func.
Example:
service, err := search.NewService( search.ResponseSize(20), )
An error is also returned when some configuration option is invalid.