Documentation
¶
Index ¶
- Constants
- type ConcExample
- type ErrorResult
- type JobLog
- type ResultType
- type RoundRobinLineSel
- func (r *RoundRobinLineSel) AllHasOutOfRangeError() bool
- func (r *RoundRobinLineSel) CurrLine() *conc.ConcordanceLine
- func (r *RoundRobinLineSel) CurrRscGetError() error
- func (r *RoundRobinLineSel) CurrRscName() string
- func (r *RoundRobinLineSel) DescribeCurr() string
- func (r *RoundRobinLineSel) GetFirstError() error
- func (r *RoundRobinLineSel) HasFatalError() bool
- func (r *RoundRobinLineSel) IsEmpty() bool
- func (r *RoundRobinLineSel) Next() bool
- func (r *RoundRobinLineSel) RscSetErrorAt(idx int, err error)
- func (r *RoundRobinLineSel) SetRscLines(rsc string, c ConcExample)
- type SerializableResult
Constants ¶
const ( ResultTypeFx = "Fx" ResultTypeFy = "Fy" ResultTypeFxy = "Fxy" ResultTypeCollocations = "Collocations" ResultTypeCollFreqData = "collFreqData" ResultTypeError = "Error" )
const (
ResultWorkerPerformance = "workerPerformance"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcExample ¶
type ConcExample struct { Lines []conc.ConcordanceLine `json:"lines"` ConcSize int `json:"concSize"` ResultType ResultType `json:"resultType"` Query string `json:"query"` Error string `json:"error"` }
func (*ConcExample) Err ¶
func (res *ConcExample) Err() error
func (*ConcExample) NumLines ¶ added in v0.1.7
func (res *ConcExample) NumLines() int
func (*ConcExample) Type ¶
func (res *ConcExample) Type() ResultType
type ErrorResult ¶
type ErrorResult struct { ResultType ResultType `json:"resultType"` Error string `json:"error"` }
func (*ErrorResult) Err ¶
func (res *ErrorResult) Err() error
func (*ErrorResult) Type ¶
func (res *ErrorResult) Type() ResultType
type JobLog ¶
type ResultType ¶
type ResultType string
func (ResultType) IsValid ¶
func (rt ResultType) IsValid() bool
func (ResultType) String ¶
func (rt ResultType) String() string
type RoundRobinLineSel ¶
type RoundRobinLineSel struct {
// contains filtered or unexported fields
}
RoundRobinLineSel allows for fetching data from multiple search results (= from different corpora) and taking them by "round robin" style. It is able to handle result sets of different sizes by cycling through less and less resources as they run out of items.
func NewRoundRobinLineSel ¶
func NewRoundRobinLineSel(maxLines int, items ...string) *RoundRobinLineSel
NewRoundRobinLineSel creates a new instance of NewRoundRobinLineSel with correctly initialized attributes.
func (*RoundRobinLineSel) AllHasOutOfRangeError ¶
func (r *RoundRobinLineSel) AllHasOutOfRangeError() bool
AllHasOutOfRangeError means that there was not a single resource able to provide lines with a required offset
func (*RoundRobinLineSel) CurrLine ¶
func (r *RoundRobinLineSel) CurrLine() *conc.ConcordanceLine
CurrLine returns the current line from a current resource during an iteration. It is intended to be called within a loop controlled by method `Next()`
func (*RoundRobinLineSel) CurrRscGetError ¶
func (r *RoundRobinLineSel) CurrRscGetError() error
CurrRscGetError returns possible error for the current resource.
func (*RoundRobinLineSel) CurrRscName ¶
func (r *RoundRobinLineSel) CurrRscName() string
CurrRscName returns the currently set resource (corpus) during iteration.
func (*RoundRobinLineSel) DescribeCurr ¶
func (r *RoundRobinLineSel) DescribeCurr() string
func (*RoundRobinLineSel) GetFirstError ¶
func (r *RoundRobinLineSel) GetFirstError() error
func (*RoundRobinLineSel) HasFatalError ¶
func (r *RoundRobinLineSel) HasFatalError() bool
HasFatalError means that each configured resource (corpus) has an error and thus there is no source we can load lines from.
func (*RoundRobinLineSel) IsEmpty ¶
func (r *RoundRobinLineSel) IsEmpty() bool
IsEmpty returns true if all the resources are emtpy
func (*RoundRobinLineSel) Next ¶
func (r *RoundRobinLineSel) Next() bool
Next prepares next line from the multi-resource result. Please note that to obtain the first item Next() must be called too. Also, once called for the first time, no new result sets can be added (this causes the call to panic)
func (*RoundRobinLineSel) RscSetErrorAt ¶
func (r *RoundRobinLineSel) RscSetErrorAt(idx int, err error)
RscSetErrorAt sets and error for idx-th resource. With that, the iteration may continue, but the errored resource is skipped.
func (*RoundRobinLineSel) SetRscLines ¶
func (r *RoundRobinLineSel) SetRscLines(rsc string, c ConcExample)
SetRscLines sets concordance data for a resource (corpus). The method can be called only if the `Next()` method has not been called yet. Otherwise the call panics.
type SerializableResult ¶
type SerializableResult interface { Type() ResultType Err() error }