query

package
v0.0.0-...-0e8dd81 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElasticQuery

type ElasticQuery struct {
	MathWebSearchIDs []int64 // list of possible formula ids
	Text             string  // Textual content
}

ElasticQuery represents an elasticsearch query

func (*ElasticQuery) RawDocumentQuery

func (q *ElasticQuery) RawDocumentQuery() (RawElasticQuery, error)

RawDocumentQuery turns this query into a RawDocumentQuery

func (*ElasticQuery) RawHighlightQuery

func (q *ElasticQuery) RawHighlightQuery(res *result.Hit) (RawElasticQuery, *elastic.Highlight, error)

RawHighlightQuery turns this query into a HighlightQuery

type Kind

type Kind int

Kind represents the type of a query

const (
	// EmptyQueryKind is an empty query
	EmptyQueryKind Kind = iota
	// MWSQueryKind represents a MathWebSearch-only query
	MWSQueryKind
	// ElasticQueryKind represents an elastic-search only query
	ElasticQueryKind
	// TemaSearchQueryKind represents a dual (MWS, TemaSearch) query
	TemaSearchQueryKind
)

type MWSExpression

type MWSExpression struct {
	XMLName xml.Name `xml:"mws:expr"`
	Term    string   `xml:",innerxml"` // the actual term being searched for
}

MWSExpression represents a single expression that is being searched for

type MWSQuery

type MWSQuery struct {
	Expressions []string `json:"expressions,omitempty"` // MathWebSearch Expressions to query for
	MwsIdsOnly  bool     `json:"mwsids,omitempty"`      // if set to true, use method "mws_ids", else "json"
}

MWSQuery represents a user-provided MWS Query

func (*MWSQuery) Raw

func (q *MWSQuery) Raw(from int64, size int64) *RawMWSQuery

Raw turns this query into a raw mws query

type Query

type Query struct {
	Expressions []string // a list of MWS-expressions to search
	Text        string   // Text to search
}

Query is a TemaSearch Query

func (*Query) ElasticQuery

func (q *Query) ElasticQuery(mwsIds []int64) *ElasticQuery

ElasticQuery turns this query into an elastic query

func (*Query) Kind

func (q *Query) Kind() Kind

Kind returns the type of this query

func (*Query) MWSQuery

func (q *Query) MWSQuery() *MWSQuery

MWSQuery turns this query into a MathWebSearch Query

func (*Query) NeedsElastic

func (q *Query) NeedsElastic() bool

NeedsElastic checks if the query needs elasticsearch to resolve

func (*Query) NeedsMWS

func (q *Query) NeedsMWS() bool

NeedsMWS checks if the query needs a MathWebSearch instance to resolve

type RawElasticQuery

type RawElasticQuery elastic.Query

RawElasticQuery represents a raw query sent to elastic query

type RawMWSQuery

type RawMWSQuery struct {
	From int64 `xml:"limitmin,attr"` // offset within the set of results
	Size int64 `xml:"answsize,attr"` // maximum number of results returned

	ReturnTotal  utils.BooleanYesNo `xml:"totalreq,attr"` // if true also compute the total number of elements
	OutputFormat string             `xml:"output,attr"`   // output format, "xml" or "json"

	Expressions []*MWSExpression // the expressions that we are searching for
}

RawMWSQuery represents a (raw) MathWebSearch Query that is sent directly to MathWebSearch

func (RawMWSQuery) MarshalXML

func (raw RawMWSQuery) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML marshales a raw query as XML

Jump to

Keyboard shortcuts

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