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.
Click to show internal directories.
Click to hide internal directories.