eventsearch

package
v0.0.2-rc-ci Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Code generated by scripts/gen/go/searchaggregation/main.go. DO NOT EDIT.

Code generated by scripts/gen/go/searchfilter/main.go. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Router

func Router(service Service) func(chi.Router)

Router returns an http router for the search service.

Types

type Aggregation

type Aggregation interface {
	// SearchAggregation converts the aggregation to a search.Aggregation.
	SearchAggregation() search.Aggregation
}

Aggregation is an event aggregation.

type Aggregations

type Aggregations map[string]Aggregation

Aggregations maps a name to a aggregation. This allows multiple aggregations on the same field with different filters.

func (Aggregations) SearchAggregations

func (s Aggregations) SearchAggregations() map[string]search.Aggregation

type ChildrenFilter

type ChildrenFilter struct {
	Children bool
}

func (ChildrenFilter) SearchFilter

func (f ChildrenFilter) SearchFilter() search.Filter

type ChildrenTermsAggregation

type ChildrenTermsAggregation struct {
	Filters Filters
}

func (ChildrenTermsAggregation) SearchAggregation

func (a ChildrenTermsAggregation) SearchAggregation() search.Aggregation

type DateDateRangeAggregation

type DateDateRangeAggregation struct {
	Filters Filters
}

func (DateDateRangeAggregation) SearchAggregation

func (a DateDateRangeAggregation) SearchAggregation() search.Aggregation

type DateFilter

type DateFilter struct {
	Date time.Time
}

func (DateFilter) SearchFilter

func (f DateFilter) SearchFilter() search.Filter

type DateRangeFilter

type DateRangeFilter struct {
	DateMin time.Time
	DateMax time.Time
}

func (DateRangeFilter) SearchFilter

func (f DateRangeFilter) SearchFilter() search.Filter

type DateTermsAggregation

type DateTermsAggregation struct {
	Filters Filters
}

func (DateTermsAggregation) SearchAggregation

func (a DateTermsAggregation) SearchAggregation() search.Aggregation

type DayDateRangeAggregation

type DayDateRangeAggregation struct {
	Filters Filters
}

func (DayDateRangeAggregation) SearchAggregation

func (a DayDateRangeAggregation) SearchAggregation() search.Aggregation

type DayFilter

type DayFilter struct {
	Day time.Time
}

func (DayFilter) SearchFilter

func (f DayFilter) SearchFilter() search.Filter

type DayRangeFilter

type DayRangeFilter struct {
	DayMin time.Time
	DayMax time.Time
}

func (DayRangeFilter) SearchFilter

func (f DayRangeFilter) SearchFilter() search.Filter

type DayTermsAggregation

type DayTermsAggregation struct {
	Filters Filters
}

func (DayTermsAggregation) SearchAggregation

func (a DayTermsAggregation) SearchAggregation() search.Aggregation

type EndDateRangeAggregation

type EndDateRangeAggregation struct {
	Filters Filters
}

func (EndDateRangeAggregation) SearchAggregation

func (a EndDateRangeAggregation) SearchAggregation() search.Aggregation

type EndFilter

type EndFilter struct {
	End time.Time
}

func (EndFilter) SearchFilter

func (f EndFilter) SearchFilter() search.Filter

type EndRangeFilter

type EndRangeFilter struct {
	EndMin time.Time
	EndMax time.Time
}

func (EndRangeFilter) SearchFilter

func (f EndRangeFilter) SearchFilter() search.Filter

type EndTermsAggregation

type EndTermsAggregation struct {
	Filters Filters
}

func (EndTermsAggregation) SearchAggregation

func (a EndTermsAggregation) SearchAggregation() search.Aggregation

type EventDocument

type EventDocument struct {
	ID          string           `json:"id"`
	Canceled    bool             `json:"canceled"`
	Listed      bool             `json:"listed"`
	Published   bool             `json:"published"`
	Name        string           `json:"name"`
	Organizers  []Organizer      `json:"organizers"`
	Involved    []event.Involved `json:"involved"`
	Location    *Location        `json:"location"`
	Location2   string           `json:"location2"`
	Description string           `json:"description"`
	Date        time.Time        `json:"day"`
	// MultiDay tracks the day of a multiday event
	//   -2 for the raw multi day event
	//   -1 for single day event
	//   n for the nth day of a multiday event
	MultiDay       int                    `json:"multiday"`
	Start          time.Time              `json:"start"`
	End            *time.Time             `json:"end"`
	Tags           []string               `json:"tags"`
	Image          string                 `json:"image"`
	Children       []*EventDocument       `json:"children,omitempty"`
	RepeatingEvent *revent.RepeatingEvent `json:"repeatingEvent,omitempty"`
	// contains filtered or unexported fields
}

func (*EventDocument) Identifier

func (e *EventDocument) Identifier() string

Identifier returns the event id.

func (*EventDocument) QueryText

func (e *EventDocument) QueryText() string

QueryText consists of the following fields:

  • Name
  • Description
  • Organizers (Name or Group.Name)
  • Location (Name or Place.Name)
  • Tags

The query text is used when making a text search.

func (*EventDocument) SearchFields

func (e *EventDocument) SearchFields() map[string]interface{}

SearchFields returns a map of fields to be index for searching.

func (*EventDocument) Type

func (e *EventDocument) Type() string

Type returns "event" as the event type.

type Filter

type Filter interface {
	// SearchFilter converts the the filter to a search.Filter.
	SearchFilter() search.Filter
}

Filter is an event filter, that can reduce an event search.

type Filters

type Filters []Filter

Filters is a list of filters. They can be converted to a list of search.Filter.

func (Filters) SearchFilters

func (s Filters) SearchFilters() []search.Filter

SearchFilters converts the list of filters to a list of search filters.

type GroupIDFilter

type GroupIDFilter struct {
	GroupID string
}

func (GroupIDFilter) SearchFilter

func (f GroupIDFilter) SearchFilter() search.Filter

type GroupIDTermsAggregation

type GroupIDTermsAggregation struct {
	Filters Filters
}

func (GroupIDTermsAggregation) SearchAggregation

func (a GroupIDTermsAggregation) SearchAggregation() search.Aggregation

type GroupIDsFilter

type GroupIDsFilter struct {
	GroupIDs []string
}

func (GroupIDsFilter) SearchFilter

func (f GroupIDsFilter) SearchFilter() search.Filter

type IDFilter

type IDFilter struct {
	ID string
}

func (IDFilter) SearchFilter

func (f IDFilter) SearchFilter() search.Filter

type IDTermsAggregation

type IDTermsAggregation struct {
	Filters Filters
}

func (IDTermsAggregation) SearchAggregation

func (a IDTermsAggregation) SearchAggregation() search.Aggregation

type IDsFilter

type IDsFilter struct {
	IDs []string
}

func (IDsFilter) SearchFilter

func (f IDsFilter) SearchFilter() search.Filter

type ISFilter

type ISFilter struct {
	IS string
}

func (ISFilter) SearchFilter

func (f ISFilter) SearchFilter() search.Filter

type ISTermsAggregation

type ISTermsAggregation struct {
	Filters Filters
}

func (ISTermsAggregation) SearchAggregation

func (a ISTermsAggregation) SearchAggregation() search.Aggregation

type ISsFilter

type ISsFilter struct {
	ISs []string
}

func (ISsFilter) SearchFilter

func (f ISsFilter) SearchFilter() search.Filter

type InvolvedBucket

type InvolvedBucket []event.Involved

func (InvolvedBucket) BucketType

func (i InvolvedBucket) BucketType() search.AggregationType

type InvolvedObjectsAggregation

type InvolvedObjectsAggregation struct {
	Filters Filters
}

func (InvolvedObjectsAggregation) SearchAggregation

func (a InvolvedObjectsAggregation) SearchAggregation() search.Aggregation

type ListedFilter

type ListedFilter struct {
	Listed bool
}

func (ListedFilter) SearchFilter

func (f ListedFilter) SearchFilter() search.Filter

type ListedTermsAggregation

type ListedTermsAggregation struct {
	Filters Filters
}

func (ListedTermsAggregation) SearchAggregation

func (a ListedTermsAggregation) SearchAggregation() search.Aggregation

type Location

type Location struct {
	Place *place.Place `json:"place,omitempty"`
	Name  string       `json:"name,omitempty"`
}

Location can either be a place.Place or a string

type Location2Filter

type Location2Filter struct {
	Location2 string
}

func (Location2Filter) SearchFilter

func (f Location2Filter) SearchFilter() search.Filter

type Location2TermsAggregation

type Location2TermsAggregation struct {
	Filters Filters
}

func (Location2TermsAggregation) SearchAggregation

func (a Location2TermsAggregation) SearchAggregation() search.Aggregation

type Location2sFilter

type Location2sFilter struct {
	Location2s []string
}

func (Location2sFilter) SearchFilter

func (f Location2sFilter) SearchFilter() search.Filter

type LocationFilter

type LocationFilter struct {
	Location string
}

func (LocationFilter) SearchFilter

func (f LocationFilter) SearchFilter() search.Filter

type LocationTermsAggregation

type LocationTermsAggregation struct {
	Filters Filters
}

func (LocationTermsAggregation) SearchAggregation

func (a LocationTermsAggregation) SearchAggregation() search.Aggregation

type LocationsFilter

type LocationsFilter struct {
	Locations []string
}

func (LocationsFilter) SearchFilter

func (f LocationsFilter) SearchFilter() search.Filter

type MultidayFilter

type MultidayFilter struct {
	Multiday int
}

func (MultidayFilter) SearchFilter

func (f MultidayFilter) SearchFilter() search.Filter

type MultidayRangeFilter

type MultidayRangeFilter struct {
	MultidayMin *int
	MultidayMax *int
}

func (MultidayRangeFilter) SearchFilter

func (f MultidayRangeFilter) SearchFilter() search.Filter

type MultidayTermsAggregation

type MultidayTermsAggregation struct {
	Filters Filters
}

func (MultidayTermsAggregation) SearchAggregation

func (a MultidayTermsAggregation) SearchAggregation() search.Aggregation

type NameFilter

type NameFilter struct {
	Name string
}

func (NameFilter) SearchFilter

func (f NameFilter) SearchFilter() search.Filter

type NameTermsAggregation

type NameTermsAggregation struct {
	Filters Filters
}

func (NameTermsAggregation) SearchAggregation

func (a NameTermsAggregation) SearchAggregation() search.Aggregation

type NamesFilter

type NamesFilter struct {
	Names []string
}

func (NamesFilter) SearchFilter

func (f NamesFilter) SearchFilter() search.Filter

type NotFilter

type NotFilter struct {
	Filter Filter
}

func (NotFilter) SearchFilter

func (n NotFilter) SearchFilter() search.Filter

type Options

type Options struct {
	// Query is the search query used for a text search.
	Query string `json:"query"`

	// Sort is the field, that should be sorted by.
	// When left empty, the default sorting is used.
	Sort string `json:"sort"`

	// SortDescending defines the sort order.
	SortDescending bool `json:"sortAscending"`

	// Page is the current page.
	Page int `json:"page"`

	// PageSize defines the number of events returned per page.
	//
	// PageSize is infinite when set to 0.
	PageSize int `json:"pageSize"`

	// Filters is a list of filters, that reduce the search result. All filters
	// are combined with AND logic in addition with the search query.
	Filters Filters `json:"filters"`

	// Aggregations is a map of aggregations. Each map key corresponds to a
	// bucket of aggregated items with the same ke.
	Aggregations Aggregations `json:"aggregations"`

	// Omit takes a list of fields, tha will be removed from all response
	// objects recursively.
	Omit []string `json:"omit"`
}

Options is a set of options, that can be used to modify a search result. swagger:parameters eventsearch eventsearch

func OptionsFromRequest

func OptionsFromRequest(r *http.Request) (Options, error)

OptionsFromRequest parses Options from a http.Request

type Organizer

type Organizer struct {
	Group *group.Group `json:"group,omitempty"`
	Name  string       `json:"name,omitempty"`
}

Organizer can either be a group.Group or a string

type OrganizerFilter

type OrganizerFilter struct {
	Organizer string
}

func (OrganizerFilter) SearchFilter

func (f OrganizerFilter) SearchFilter() search.Filter

type OrganizerTermsAggregation

type OrganizerTermsAggregation struct {
	Filters Filters
}

func (OrganizerTermsAggregation) SearchAggregation

func (a OrganizerTermsAggregation) SearchAggregation() search.Aggregation

type OrganizersFilter

type OrganizersFilter struct {
	Organizers []string
}

func (OrganizersFilter) SearchFilter

func (f OrganizersFilter) SearchFilter() search.Filter

type OwnedByFilter

type OwnedByFilter struct {
	OwnedBy string
}

func (OwnedByFilter) SearchFilter

func (f OwnedByFilter) SearchFilter() search.Filter

type OwnedByTermsAggregation

type OwnedByTermsAggregation struct {
	Filters Filters
}

func (OwnedByTermsAggregation) SearchAggregation

func (a OwnedByTermsAggregation) SearchAggregation() search.Aggregation

type OwnedBysFilter

type OwnedBysFilter struct {
	OwnedBys []string
}

func (OwnedBysFilter) SearchFilter

func (f OwnedBysFilter) SearchFilter() search.Filter

type PlaceIDFilter

type PlaceIDFilter struct {
	PlaceID string
}

func (PlaceIDFilter) SearchFilter

func (f PlaceIDFilter) SearchFilter() search.Filter

type PlaceIDTermsAggregation

type PlaceIDTermsAggregation struct {
	Filters Filters
}

func (PlaceIDTermsAggregation) SearchAggregation

func (a PlaceIDTermsAggregation) SearchAggregation() search.Aggregation

type PlaceIDsFilter

type PlaceIDsFilter struct {
	PlaceIDs []string
}

func (PlaceIDsFilter) SearchFilter

func (f PlaceIDsFilter) SearchFilter() search.Filter

type Result

type Result struct {
	// Events are the events found for the current pagination.
	Events []*EventDocument `json:"events"`

	// Total is the total number of events in the search result.
	// It is independet of the current pagination.
	Total uint64 `json:"total"`

	// Buckets is a set of aggregation buckets.
	// The map key corresponds to aggregation name.
	Buckets map[string]search.Bucket `json:"buckets"`
}

Result contains an event search result. swagger:response eventsearchResult

type Service

type Service interface {
	// Search makes a search in the search database for events. The result can
	// be modified using Options.
	Search(ctx context.Context, opts Options) (*Result, error)
	// Index takes one or many event and adds them to the search index.
	Index(e ...*event.Event) error
	// LastModified returns the time the index was last modified.
	LastModified() time.Time
	// Reindex makes sure, that the state of the search index is the same as in the
	// event database.
	Reindex(ctx context.Context) error
}

-go:generate go run github.com/petergtz/pegomock/pegomock generate eintopf.info/service/eventsearch Service --output=../../internal/mock/eventsearch_service.go --package=mock --mock-name=EventSearchService

type ServiceImpl

type ServiceImpl struct {
	// contains filtered or unexported fields
}

ServiceImpl is an implementation of Service.

func NewService

func NewService(
	searchService search.Service,
	eventService event.Storer,
	groupService group.Service,
	placeService place.Service,
	repeatingEventService revent.Service,
) *ServiceImpl

NewService returns a new ServiceImpl.

func (*ServiceImpl) ConsumeOperation

func (s *ServiceImpl) ConsumeOperation(op oqueue.Operation) error

ConsumeOperation consumes an event operations of the type create, update and delete. Depending on wether the model is searchable, it performs an index or a delete operation on the search index.

func (*ServiceImpl) EventDocumentsFromEvent

func (s *ServiceImpl) EventDocumentsFromEvent(e *event.Event) []*EventDocument

func (*ServiceImpl) Index

func (s *ServiceImpl) Index(events ...*event.Event) error

func (*ServiceImpl) LastModified

func (s *ServiceImpl) LastModified() time.Time

func (*ServiceImpl) Reindex

func (s *ServiceImpl) Reindex(ctx context.Context) error

Reindex makes sure, that the state of the search index is the same as in the event database.

func (ServiceImpl) Search

func (s ServiceImpl) Search(ctx context.Context, opts Options) (*Result, error)

type StartDateRangeAggregation

type StartDateRangeAggregation struct {
	Filters Filters
}

func (StartDateRangeAggregation) SearchAggregation

func (a StartDateRangeAggregation) SearchAggregation() search.Aggregation

type StartFilter

type StartFilter struct {
	Start time.Time
}

func (StartFilter) SearchFilter

func (f StartFilter) SearchFilter() search.Filter

type StartRangeFilter

type StartRangeFilter struct {
	StartMin time.Time
	StartMax time.Time
}

func (StartRangeFilter) SearchFilter

func (f StartRangeFilter) SearchFilter() search.Filter

type StartTermsAggregation

type StartTermsAggregation struct {
	Filters Filters
}

func (StartTermsAggregation) SearchAggregation

func (a StartTermsAggregation) SearchAggregation() search.Aggregation

type TagFilter

type TagFilter struct {
	Tag string
}

func (TagFilter) SearchFilter

func (f TagFilter) SearchFilter() search.Filter

type TagTermsAggregation

type TagTermsAggregation struct {
	Filters Filters
}

func (TagTermsAggregation) SearchAggregation

func (a TagTermsAggregation) SearchAggregation() search.Aggregation

type TagsFilter

type TagsFilter struct {
	Tags []string
}

func (TagsFilter) SearchFilter

func (f TagsFilter) SearchFilter() search.Filter

Jump to

Keyboard shortcuts

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