indexer

package
v0.0.0-...-e97be17 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned by the indexer when attempting to look up
	// a document that does not exist.
	ErrNotFound = xerrors.New("not found")

	// ErrMissingLinkID is returned when attempting to index a document
	// that does not specify a valid link ID.
	ErrMissingLinkID = xerrors.New("document does not provide a valid linkID")
)

Functions

This section is empty.

Types

type Document

type Document struct {
	LinkID uuid.UUID
	URL    string
	// The Title and Content attributes correspond to the value of the <title> element
	// if the link points to an HTML page, whereas the Content attribute stores
	// the block of text that was extracted by the crawler when processing the link.
	Title   string
	Content string
	// indicates when a particular document was last indexed
	IndexedAt time.Time
	// track the score that will be assigned to each document by the PageRank calculator component
	PageRank float64
}

type Indexer

type Indexer interface {
	Index(doc *Document) error
	FindByID(linkID uuid.UUID) (*Document, error)
	Search(query Query) (Iterator, error)
	UpdateScore(linkID uuid.UUID, score float64) error
}

type Iterator

type Iterator interface {
	Close() error
	Next() bool
	Error() error
	Document() *Document
	TotalCount() uint64
}

type Query

type Query struct {
	Type   QueryType
	Expr   string // stores the search query that's entered by the end user
	Offset uint64
}

type QueryType

type QueryType uint8
const (
	Match QueryType = iota
	Phrase
)

Directories

Path Synopsis
store
es

Jump to

Keyboard shortcuts

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