couchdb

package
v0.0.0-...-7c66d03 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error404 = errors.New("Doc not found. ")

Error404 the error you get when no document was found

View Source
var ErrorNoLatestVersion = errors.New("Not latest revision.")

ERROR_NO_LATEST_VERSION error you get when trying to save an old version of a CouchDB document

Functions

func IsItParsed

func IsItParsed(path string) bool

IsItParsed checks if the given url is already parsed

func ShouldURLBeFetched

func ShouldURLBeFetched(target string) bool

ShouldURLBeFetched checks if the given url is already stored in the database

Types

type CouchDoc

type CouchDoc struct {
	ID           string              `json:"_id"`
	Rev          string              `json:"_rev"`
	URL          string              `json:"url"`
	HTML         string              `json:"html"`
	Text         parse.PageStructure `json:"text"`
	Links        []string            `json:"links,omitempty"`
	LinksToQueue []string            `json:"-"`
	ParsedOn     time.Time           `json:"parsed_on,omitempty"`
	FetchedOn    time.Time           `json:"fetched_on,omitempty"`
}

CouchDoc represents a response fron CouchDB

func GetURLData

func GetURLData(id string) (CouchDoc, error)

GetURLData gets the data stored in Couch, does a lookup by doc id

type CouchDocCreated

type CouchDocCreated struct {
	OK  bool   `json:"ok"`
	ID  string `json:"id"`
	Rev string `json:"rev"`
}

CouchDocCreated represents a full document

func AddURLData

func AddURLData(url string, data []byte, mainURL bool) (CouchDocCreated, error)

AddURLData adds the url and data to the database. data is json encoded.

func SaveExtractedTextAndLinks(id string, data []byte) (CouchDocCreated, error)

SaveExtractedTextAndLinks updates the document with extraced information like text and links

type NewSite

type NewSite struct {
	Site string `json:"site"`
}

NewSite is used to add a new url submitted

type StatsIndex

type StatsIndex struct {
	Parsed, Fetched int
	Sites           []string
}

StatsIndex Stats related to the search engine index

func IndexStats

func IndexStats() *StatsIndex

IndexStats returns stats related to the index, cnt of parsed/fetched/etc

Jump to

Keyboard shortcuts

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