search

package
v0.0.0-...-82d9017 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ChunckLen = 10

The number of element in a chunck (aka the result page)

Variables

View Source
var ErrPageTooLong = errors.New("Page argument too long")

Functions

This section is empty.

Types

type DB

type DB struct {
	// Get a page from the crawler database.
	CrawlerDB *crawldatabase.Database[crawler.Page]
	// Get for a word key, all pages with the word and occurence coeficient.
	// The sub slice are sorted by key.
	ReverseIndex map[keys.Key][]index.KeyFloat32
	// Get a global score, like a page rank.
	GlobalScore map[keys.Key]float32
}

func FakeDB

func FakeDB() *DB

func (*DB) Search

func (db *DB) Search(queryString string, chunck int) (*Result, error)

type PageResult

type PageResult struct {
	// The page key and his URL.
	Key keys.Key
	URL url.URL
	// Metadata of the page.
	Title       string
	Description string
}

type Query

type Query struct {
	// The normalized word from the user input.
	Word string
	// The key of the word.
	Key keys.Key
	// Number of page with this article
	Count int
}

type Result

type Result struct {
	// Parsed query, the keywords
	Queries []Query
	// The (at most ChunckLen) page details (title, URL...)
	Results []PageResult
	// The number of founded page
	NumberOfResults int
	// The number of chunck (result page)
	NumberOfChunck int
}

Jump to

Keyboard shortcuts

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