article

package
v0.0.0-...-3bd2bae Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authors

func Authors(f string) func(*Opts)

func Body

func Body(f string) func(*Opts)

func Cases

func Cases(searchCases bool) func(*Opts)

func DataType

func DataType(d int) func(*Opts)

func DocID

func DocID(q string) func(*Opts)

func Feeds

func Feeds(f string) func(*Opts)

func Index

func Index(i string) func(*Opts)

func Keywords

func Keywords(f string) func(*Opts)

func Langs

func Langs(f string) func(*Opts)

func Limit

func Limit(i int) func(*Opts)

func OptsFromURL

func OptsFromURL(urlQuery func(string) string) []func(*Opts)

func Q

func Q(q string) func(*Opts)

func Range

func Range(By, From, To string) func(*Opts)

func RangeBy

func RangeBy(i string) func(*Opts)

func RangeFrom

func RangeFrom(i string) func(*Opts)

func RangeTo

func RangeTo(i string) func(*Opts)

func Skip

func Skip(i int) func(*Opts)

func Sort

func Sort(By string, Asc bool) func(*Opts)

func Tags

func Tags(f string) func(*Opts)

func Title

func Title(f string) func(*Opts)

func Topics

func Topics(f string) func(*Opts)

func Type

func Type(i string) func(*Opts)

Types

type Document

type Document struct {
	DocID      string    `json:"docId"`
	Lang       string    `json:"lang"`
	CrawledAt  time.Time `json:"crawledAt"`
	ScreenName string    `json:"screen_name"`
	URL        string    `json:"url"`
	TweetID    int64     `json:"tweet_id"`
	TweetIDStr string    `json:"tweet_id_str"`
	Content    struct {
		Title       string    `json:"title,omitempty"`
		Excerpt     string    `json:"excerpt,omitempty"`
		Image       string    `json:"image,omitempty"`
		Body        string    `json:"body,omitempty"`
		Authors     []string  `json:"authors,omitempty"`
		Sources     []string  `json:"sources,omitempty"`
		Tags        []string  `json:"tags,omitempty"`
		Categories  []string  `json:"categories,omitempty"`
		PublishedAt time.Time `json:"publishedAt,omitempty"`
		EditedAt    time.Time `json:"editedAt,omitempty"`
	} `json:"content"`
	NLP struct {
		Keywords  []string  `json:"keywords,omitempty"`
		StopWords []string  `json:"stopWords,omitempty"`
		Entities  []*Entity `json:"entities,omitempty"`
		Topics    []string  `json:"topics,omitempty"`
		Quotes    []string  `json:"quotes,omitempty"`
		Claims    []string  `json:"claims,omitempty"`
		Summary   string    `json:"summary,omitempty"`
	} `json:"nlp"`

	Feed     *feed.Feed `json:"feed,omitempty"`
	RelCount int64      `json:"relCount,omitempty"`
}

Document Raw document stored on elasticsearch

func Get

func Get(ctx context.Context, es *es.ES, id string) (*Document, error)

Get Get Raw Article by ID from ealasticsearch

func List

func List(ctx context.Context, es *es.ES, options *Opts) ([]*Document, int64, error)

List All Articles from ealasticsearch

type Entity

type Entity struct {
	EntityText string `json:"entity_text"`
	EntityType string `json:"entity_type"`
}

Entity extracted entities from enrich service

type Opts

type Opts struct {
	Index string
	Type  string
	Sort  struct {
		By  string
		Asc bool
	}

	DataType int
	Cases    bool

	Skip  int
	Limit int

	DocID string

	Q        string
	Title    string
	Body     string
	Tags     string
	Topics   string
	Authors  string
	Langs    string
	Feeds    string
	Keywords string

	Range struct {
		By   string
		From string
		To   string
	}
}

func NewSearch

func NewSearch(urlQuery func(string) string) *Opts

func (*Opts) Do

func (s *Opts) Do(es *es.ES) (*elastic.SearchResult, error)

type Pagination

type Pagination struct {
	Total int `json:"total"`
}

Jump to

Keyboard shortcuts

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