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
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) NeedsElastic ¶
NeedsElastic checks if the query needs elasticsearch to resolve
type RawElasticQuery ¶
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