rankings

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

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package rankings contains logic for parsing rankings data -- either from stored JSON files or from a database -- and combining them into a SERP containing prominent results for a search as well as the keyword that yielded those results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildError

type BuildError struct {
	Errors []error
}

BuildError represents one or more errors that could occur as the result processing a directory

func (BuildError) Error

func (be BuildError) Error() string

type KeywordData

type KeywordData map[string]SERP

KeywordData contains all SERP data for a group of keywords

func New

func New() KeywordData

New creates a new KeywordData instance

func ProcessDirectory

func ProcessDirectory(directory string) (KeywordData, error)

ProcessDirectory scans a directory for files containing SERP data and builds a KeywordData from their contents

func (KeywordData) BuildFromDatabase

func (kd KeywordData) BuildFromDatabase(driver *data.Driver, domainID int, keywords []string, bar *pb.ProgressBar) error

BuildFromDatabase fetches prominent SERP members from the database for each given keyword

func (KeywordData) BuildFromDisk

func (kd KeywordData) BuildFromDisk(paths []string) error

BuildFromDisk builds a KeywordData set by parsing and adding SERP members

type SERP

type SERP struct {
	Keyword string
	Members []SERPMember
}

SERP contains a set of related serps

func Parse

func Parse(rdr io.Reader) (SERP, error)

Parse builds a SERP by parsing from JSON data

func (SERP) Length

func (s SERP) Length() int

Length determines the length of the members in the SERP

type SERPMember

type SERPMember struct {
	Keyword    string `json:"keyword"`
	Prominence int    `json:"prominence"`
	Domain     string `json:"competitor"`
}

SERPMember represents a ranked member in prominent entries in a SERP

Jump to

Keyboard shortcuts

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