Documentation
¶
Index ¶
- Constants
- func IndexDb(ctx context.Context, index bleve.Index, cfg *config.Config) (err error)
- func IndexImages(ctx context.Context, index bleve.Index, cfg *config.Config) (err error)
- func IndexPages(ctx context.Context, index bleve.Index, cfg *config.Config) (err error)
- func NewIndex(path string, name string) (idx bleve.Index, err error)
- func OpenIndex(path string, name string) (idx bleve.Index, err error)
- type FragmentFormatter
- type ImageDoc
- type ImageSearchRequest
- type ImageSearchResponse
- type ImageSearchResult
- type PageDoc
- type PageSearchRequest
- type PageSearchResponse
- type PageSearchResult
- type RankedSort
- func (so *RankedSort) Copy() search.SearchSort
- func (so *RankedSort) Descending() bool
- func (so *RankedSort) RequiresDocID() bool
- func (so *RankedSort) RequiresFields() []string
- func (so *RankedSort) RequiresScoring() bool
- func (so *RankedSort) Reverse()
- func (so *RankedSort) UpdateVisitor(field string, term []byte)
- func (so *RankedSort) Value(a *search.DocumentMatch) string
Constants ¶
View Source
const DefaultGemHighlightAfter = "]]"
View Source
const DefaultGemHighlightBefore = "[["
View Source
const PageSize = 15
Variables ¶
This section is empty.
Functions ¶
func IndexImages ¶
func IndexPages ¶
Types ¶
type FragmentFormatter ¶
type FragmentFormatter struct {
// contains filtered or unexported fields
}
func NewFragmentFormatter ¶
func NewFragmentFormatter(before, after string) *FragmentFormatter
func (*FragmentFormatter) Format ¶
func (a *FragmentFormatter) Format(f *highlight.Fragment, orderedTermLocations highlight.TermLocations) string
type ImageSearchRequest ¶
type ImageSearchResponse ¶
type ImageSearchResponse struct {
TotalResults uint64 `json:"n"`
Results []ImageSearchResult `json:"results"`
Duration time.Duration `json:"duration"`
// used by the search daemon and cgi
Err string `json:"err,omitempty"`
}
func SearchImages ¶
func SearchImages(req ImageSearchRequest, idx bleve.Index) (resp ImageSearchResponse, err error)
type ImageSearchResult ¶
type PageSearchRequest ¶
type PageSearchResponse ¶
type PageSearchResponse struct {
TotalResults uint64 `json:"n"`
Results []PageSearchResult `json:"results"`
Duration time.Duration `json:"duration"`
// used by the search daemon and cgi
Err string `json:"err,omitempty"`
}
func SearchPages ¶
func SearchPages(req PageSearchRequest, idx bleve.Index) (resp PageSearchResponse, err error)
type PageSearchResult ¶
type PageSearchResult struct {
Url string `json:"url"`
Title string `json:"title"`
Snippet string `json:"snippet"`
UrlRank float64 `json:"prank"`
HostRank float64 `json:"hrank"`
Relevance float64 `json:"score"`
ContentType string `json:"content_type"`
ContentSize uint64 `json:"content_size"`
// used by templates; this is _not_ set by the Search function.
Hostname string `json:"-"`
}
type RankedSort ¶
type RankedSort struct {
// contains filtered or unexported fields
}
func (*RankedSort) Copy ¶
func (so *RankedSort) Copy() search.SearchSort
func (*RankedSort) Descending ¶
func (so *RankedSort) Descending() bool
func (*RankedSort) RequiresDocID ¶
func (so *RankedSort) RequiresDocID() bool
func (*RankedSort) RequiresFields ¶
func (so *RankedSort) RequiresFields() []string
func (*RankedSort) RequiresScoring ¶
func (so *RankedSort) RequiresScoring() bool
func (*RankedSort) Reverse ¶
func (so *RankedSort) Reverse()
func (*RankedSort) UpdateVisitor ¶
func (so *RankedSort) UpdateVisitor(field string, term []byte)
func (*RankedSort) Value ¶
func (so *RankedSort) Value(a *search.DocumentMatch) string
Click to show internal directories.
Click to hide internal directories.