internal

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

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ID   = "ID"
	Body = "Body"
	URL  = "URL"
)

Named Document fields for simple referencing

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	ID   string
	Body string
	URL  string
}

Document represents an indexed HTML article within our content index.

func Convert

func Convert(resources []string) ([]Document, error)

Convert attempts to follow the URLs provided as resources fetch them over the network, and parse them into Documents.

func (Document) EscapeBody

func (d Document) EscapeBody() string

EscapeBody formats the Body field of Document d, preserving any highlights which may have been added during document searching so that they may be displayed as-is in HTML format.

func (Document) String

func (d Document) String() string
type Search struct {
	IndexPath string
	// contains filtered or unexported fields
}

Search encapsulates the requisite state necessary to query and augment our Document index

func NewSearch

func NewSearch(indexPath string) *Search

NewSearch initializes the internal state of a Search type returning a ready to use reference

func (Search) AddResources

func (s Search) AddResources(resources []string) ([]Document, error)

AddResources downloads the HTML corresponding to the resources provided and after parsing them into Documents indexes them for later retrieval.

func (Search) Delete

func (s Search) Delete(urls []string) ([]string, error)

Delete removes all Documents corresponding to urls provided.

func (Search) MatchAll

func (s Search) MatchAll() ([]Document, error)

MatchAll performs a bleve.NewMatchAllQuery, returning all Documents in our index.

func (Search) Query

func (s Search) Query(q string) ([]Document, error)

Query searches for query q against our Document index.

func (Search) QueryWithHighlight

func (s Search) QueryWithHighlight(q string, highlight string) ([]Document, error)

QueryWithHighlight searches for query q against our Document index, while providing the highlights specified by highlight.

Jump to

Keyboard shortcuts

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