tinysearch

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

package tinysearch provides methods for generating tinysearch indexes from a collection of blog (Markdown) posts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexPosts

func IndexPosts(ctx context.Context, opts *IndexPostsOptions) error

IndexPosts will generate a collection of `Records` derived from a collection of posts and write them to an `io.Writer` instance.

Types

type IndexPostsOptions

type IndexPostsOptions struct {
	// Iterator is an `iter.Seq2` instance to yield `posts.Post` instances to index.
	Iterator iter.Seq2[*posts.Post, error]
	// Writer is where the final set of `Record` documents should be written.
	Writer io.Writer
	// URLPrefix is an optional prefix to assign the `Record.URL` property for each post.
	URLPrefix string
}

IndexPostsOptions defines configuration details for generating a collection of `Records` derived from a collection of posts and write them to an `io.Writer` instance.

type Record

type Record struct {
	// Title is the title of the document being indexed.
	Title string `json:"title"`
	// URL is the URL of the document being indexed.
	URL string `json:"url"`
	// Body is the body of the document (the "content") being indexed.
	Body string `json:"body"`
}

Record is a struct representing the data structure used to index context in tinysearch.

Jump to

Keyboard shortcuts

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