forum

package
v0.0.0-...-b788d29 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Indexer

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

func NewForumIndex

func NewForumIndex(path string) *Indexer

func (*Indexer) AddPost

func (f *Indexer) AddPost(b Post)

func (*Indexer) AddPosts

func (f *Indexer) AddPosts(posts []Post)

func (*Indexer) Close

func (f *Indexer) Close()

func (*Indexer) Search

func (f *Indexer) Search(query bluge.Query) (response SearchResponse)

func (*Indexer) SearchByRequest

func (f *Indexer) SearchByRequest(searchRequest bluge.SearchRequest) SearchResponse

func (*Indexer) SearchQueryString

func (f *Indexer) SearchQueryString(q string) SearchResponse

func (*Indexer) SearchThread

func (f *Indexer) SearchThread(threadId string) (response SearchResponse)

func (*Indexer) Stats

func (f *Indexer) Stats()

type Parser

type Parser interface {
	ParseResponse(body io.Reader, header http.Header, uri string) ([]Post, error)
}

type ParserBody

type ParserBody struct {
	Body   io.Reader
	Header http.Header
	Uri    string
}

wrapper struct to make it easier to package responses

type Post

type Post struct {
	Url          string `json:"url"`
	ThreadId     string `json:"threadid"`     // thead identifier, same for all posts in a thread
	PostSeq      int    `json:"threadseq"`    // post identifier, sequential in order within a thread page
	PageSeq      int    `json:"pageseq"`      // page (of thread) id, ordered
	ThreadPostId string `json:"threadpostid"` // combined key, uniquely identifies a thread+post id, ordered
	Id           string `json:"id"`           // original post key (identifies a post)
	User         string `json:"user"`
	UserIcon     string `json:"usericon"`
	Hdr          string `json:"hdr"`
	Msg          string `json:"msg"`
	Html         string `json:"html"`
}

type SearchResponse

type SearchResponse struct {
	Results     []SearchResult
	TimeSeconds time.Duration
	ResultCount uint64
}

type SearchResult

type SearchResult struct {
	Url          string                   `json:"url"`
	ThreadId     string                   `json:"threadid"`     // thead identifier, same for all posts in a thread
	PostSeq      int                      `json:"threadseq"`    // post identifier, sequential in order within a thread page
	PageSeq      int                      `json:"pageseq"`      // page (of thread) id, ordered
	ThreadPostId string                   `json:"threadpostid"` // combined key, uniquely identifies a thread+post id
	Id           string                   `json:"id"`
	User         string                   `json:"user"`
	Initials     string                   `json:"initials"`
	UserIcon     string                   `json:"usericon"`
	Hdr          string                   `json:"hdr"`
	Msg          string                   `json:"msg"`
	Html         template.HTML            `json:"html"`
	Highlights   map[string]template.HTML `json:"highlights"`
	UserColor    string                   `json:"usercolor"`
}

Jump to

Keyboard shortcuts

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