solr

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index represents an index in Solr

func NewIndex

func NewIndex(url, name string, md *index.Metadata) (*Index, error)

NewIndex creates a new solr index for the given solr url and index name. Metadata is ignored, we are using an automatic solr schema

func (*Index) AddTerms

func (i *Index) AddTerms(terms ...index.Suggestion) error

AddTerms doesn't do anything and is here for interface compliance reasons.

Not implemented since we do this automatically in the indexing itself

func (*Index) Create

func (i *Index) Create() error

Create creates the index on Solr

func (*Index) Delete

func (i *Index) Delete() error

Delete deletes all entries in the index

func (*Index) Drop

func (i *Index) Drop() error

Drop deletes the index

func (*Index) FullTextQuerySingleField

func (i *Index) FullTextQuerySingleField(q query.Query, verbose int) (docs []index.Document, total int, err error)

Search searches the index for the given query, and returns documents, the total number of results, or an error if something went wrong

func (*Index) GetName

func (i *Index) GetName() string

func (*Index) Index

func (i *Index) Index(documents []index.Document, options interface{}) error

Index indexes multiple documents on the index, with optional IndexingOptions passed to options

func (*Index) PrefixQuery

func (i *Index) PrefixQuery(q query.Query, verbose int) (docs []index.Document, total int, err error)

Search searches the index for the given query, and returns documents, the total number of results, or an error if something went wrong

func (*Index) Suggest

func (i *Index) Suggest(prefix string, num int, fuzzy bool) ([]index.Suggestion, error)

Suggest gets completion suggestions from solr

func (*Index) WildCardQuery

func (i *Index) WildCardQuery(q query.Query, verbose int) (docs []index.Document, total int, err error)

Search searches the index for the given query, and returns documents, the total number of results, or an error if something went wrong

type SuggestResponse

type SuggestResponse struct {
	ResponseHeader struct {
		Status int `json:"status"`
		QTime  int `json:"QTime"`
	} `json:"responseHeader"`
	Suggest struct {
		Autocomplete map[string]struct {
			NumFound    int `json:"numFound"`
			Suggestions []struct {
				Term    string  `json:"term"`
				Weight  float64 `json:"weight"`
				Payload string  `json:"payload"`
			} `json:"suggestions"`
		} `json:"autocomplete"`
	} `json:"suggest"`
}

SuggestResponse parses the suggest responses because the solr client doesn't include this feature

Jump to

Keyboard shortcuts

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