search

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package search provides searching for notes using bleve library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildIndex

func BuildIndex(notesPath string) (bleve.Index, error)

BuildIndex initializes an in-memory Bleve index and populates it with documents from the specified notesPath.

func DeleteDocument

func DeleteDocument(idx bleve.Index, path string) error

DeleteDocument removes a document from the search index by its path.

func IndexDocument

func IndexDocument(idx bleve.Index, doc IndexedDocument) error

IndexDocument adds or updates a document in the search index.

func ReindexAll

func ReindexAll(idx bleve.Index, notesPath string) error

ReindexAll reads the notes directory, parses markdown files, and adds them to the provided Bleve search index.

func Search(idx bleve.Index, queryStr, tagInput string, start, end time.Time, dateField string, limit int) (*bleve.SearchResult, error)

Search queries the index for a given string across titles and contents, using a combination of prefix and fuzzy matching.

Types

type IndexedDocument

type IndexedDocument struct {
	Title   string    `json:"title"`
	Content string    `json:"content"`
	Tags    []string  `json:"tags"`
	Path    string    `json:"path"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

IndexedDocument represents a note's search-ready data structure.

func DocToIndexed

func DocToIndexed(d frontmatter.Document) IndexedDocument

DocToIndexed converts a parsed markdown document with frontmatter into an IndexedDocument suitable for the search engine.

Jump to

Keyboard shortcuts

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