search

package
v0.0.0-...-8d8d9e6 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package search manages the searching of results against different news feeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BBC

type BBC struct{}

BBC provides support for BBC searches.

func (BBC) Search

func (BBC) Search(uid string, term string, found chan<- []Result)

Search performs a search against the CNN RSS feeds.

type CNN

type CNN struct{}

CNN provides support for CNN searches.

func (CNN) Search

func (CNN) Search(uid string, term string, found chan<- []Result)

Search performs a search against the CNN RSS feeds.

type Channel

type Channel struct {
	XMLName xml.Name `xml:"channel"`
	Image   Image    `xml:"image"`
	Items   []Item   `xml:"item"`
}

Channel defines the fields associated with the channel tag in the buoy RSS document.

type Document

type Document struct {
	XMLName xml.Name `xml:"rss"`
	Channel Channel  `xml:"channel"`
}

Document defines the fields associated with the buoy RSS document.

type Image

type Image struct {
	XMLName xml.Name `xml:"image"`
	URL     string   `xml:"url"`
	Title   string   `xml:"title"`
	Link    string   `xml:"link"`
}

Image defines the fields associated with the image tag in the buoy RSS document.

type Item

type Item struct {
	XMLName     xml.Name `xml:"item"`
	PubDate     string   `xml:"pubDate"`
	Title       string   `xml:"title"`
	Description string   `xml:"description"`
	Link        string   `xml:"link"`
}

Item defines the fields associated with the item tag in the buoy RSS document.

type NYT

type NYT struct{}

NYT provides support for NYT searches.

func (NYT) Search

func (NYT) Search(uid string, term string, found chan<- []Result)

Search performs a search against the NYT RSS feeds.

type Options

type Options struct {
	Term  string
	CNN   bool
	NYT   bool
	BBC   bool
	First bool
}

Options provides the search options for performing searches.

type Result

type Result struct {
	Engine  string
	Title   string
	Link    string
	Content string
}

Result represents a search result that was found.

func Submit

func Submit(uid string, options Options) []Result

Submit uses goroutines and channels to perform a search against the feeds concurrently.

func (*Result) ContentHTML

func (r *Result) ContentHTML() template.HTML

ContentHTML fixes encoding issues.

func (*Result) TitleHTML

func (r *Result) TitleHTML() template.HTML

TitleHTML fixes encoding issues.

type Searcher

type Searcher interface {
	Search(uid string, term string, found chan<- []Result)
}

Searcher declares an interface used to leverage different search engines to find results.

func NewBBC

func NewBBC() Searcher

NewBBC returns a BBC Searcher value.

func NewCNN

func NewCNN() Searcher

NewCNN returns a CNN Searcher value.

func NewNYT

func NewNYT() Searcher

NewNYT returns a NYT Searcher value.

Jump to

Keyboard shortcuts

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