searchengine

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

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetaDocument

type MetaDocument struct {
	ID      string `json:"id"` // ID is the document path
	Body    string `json:"body"`
	Summary string `json:"summary"`
}

MetaDocument holds the meta document info and summary

type QueryResults

type QueryResults struct {
	Query    string   `json:"query"`
	CutScore float64  `json:"cutscore"`
	Results  []Result `json:"results"`
}

QueryResults holds a slice of returns

type Result

type Result struct {
	ID    string  `json:"id"`
	Score float64 `json:"score"`
}

Result is a query result holder

type SearchEngine

type SearchEngine struct {
	// contains filtered or unexported fields
}

SearchEngine represents a generic search engine wrapping bleve

func NewSearchEngine

func NewSearchEngine(indexPath string, summarizer *summarizer.PersistentSummarizer) *SearchEngine

NewSearchEngine creates a new search engine

func (*SearchEngine) AddDocuments

func (se *SearchEngine) AddDocuments(filePath string) error

AddDocuments creates the needed meta info around a file, reads it and holds its summary

func (*SearchEngine) CloseIndex

func (se *SearchEngine) CloseIndex()

CloseIndex safely closes an open index

func (*SearchEngine) CreateOrOpenIndex

func (se *SearchEngine) CreateOrOpenIndex(indexPath string) error

CreateOrOpenIndex sets up the search index structure

func (*SearchEngine) Query

func (se *SearchEngine) Query(query string) (*QueryResults, error)

Query , fetch results, rank and aggregate

Jump to

Keyboard shortcuts

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