Documentation ¶
Index ¶
- func MetricsMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func NormalizeLossyURL(raw string) string
- type ActorSearchParams
- type EsSearchHit
- type EsSearchHits
- type EsSearchResponse
- func DoSearchGeneric(ctx context.Context, escli *es.Client, index, q string) (*EsSearchResponse, error)
- func DoSearchPosts(ctx context.Context, dir identity.Directory, escli *es.Client, index string, ...) (*EsSearchResponse, error)
- func DoSearchProfiles(ctx context.Context, dir identity.Directory, escli *es.Client, index string, ...) (*EsSearchResponse, error)
- func DoSearchProfilesTypeahead(ctx context.Context, escli *es.Client, index string, params *ActorSearchParams) (*EsSearchResponse, error)
- type HealthStatus
- type Indexer
- func (idx *Indexer) BulkIndexPageranks(ctx context.Context, pagerankFile string) error
- func (idx *Indexer) BulkIndexPosts(ctx context.Context, postsFile string) error
- func (idx *Indexer) BulkIndexProfiles(ctx context.Context, profilesFile string) error
- func (idx *Indexer) EnsureIndices(ctx context.Context) error
- func (idx *Indexer) RunIndexer(ctx context.Context) error
- type IndexerConfig
- type LastSeq
- type PagerankIndexJob
- type PostDoc
- type PostIndexJob
- type PostSearchParams
- type PostSearchResult
- type ProfileDoc
- type ProfileIndexJob
- type Server
- func (s *Server) EnsureIndices(ctx context.Context) error
- func (s *Server) RunAPI(listen string) error
- func (s *Server) RunMetrics(listen string) error
- func (s *Server) SearchPosts(ctx context.Context, params *PostSearchParams) (*appbsky.UnspeccedSearchPostsSkeleton_Output, error)
- func (s *Server) SearchProfiles(ctx context.Context, params *ActorSearchParams) (*appbsky.UnspeccedSearchActorsSkeleton_Output, error)
- func (s *Server) Shutdown(ctx context.Context) error
- type ServerConfig
- type UserResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MetricsMiddleware ¶
func MetricsMiddleware(next echo.HandlerFunc) echo.HandlerFunc
MetricsMiddleware defines handler function for metrics middleware
func NormalizeLossyURL ¶
aggressively normalizes URL, for search indexing and matching. it is possible the URL won't be directly functional after this normalization
Types ¶
type ActorSearchParams ¶
type ActorSearchParams struct { Query string `json:"q"` Typeahead bool `json:"typeahead"` Follows []syntax.DID `json:"follows"` Viewer *syntax.DID `json:"viewer"` Offset int `json:"offset"` Size int `json:"size"` }
func (*ActorSearchParams) Filters ¶
func (p *ActorSearchParams) Filters() []map[string]interface{}
Filters turns search params in to actual elasticsearch/opensearch filter DSL
type EsSearchHit ¶
type EsSearchHit struct { Index string `json:"_index"` ID string `json:"_id"` Score float64 `json:"_score"` Source json.RawMessage `json:"_source"` }
type EsSearchHits ¶
type EsSearchHits struct { Total struct { Value int Relation string } `json:"total"` MaxScore float64 `json:"max_score"` Hits []EsSearchHit `json:"hits"` }
type EsSearchResponse ¶
type EsSearchResponse struct { Took int `json:"took"` TimedOut bool `json:"timed_out"` Hits EsSearchHits `json:"hits"` }
func DoSearchGeneric ¶
func DoSearchGeneric(ctx context.Context, escli *es.Client, index, q string) (*EsSearchResponse, error)
helper to do a full-featured Lucene query parser (query_string) search, with all possible facets. Not safe to expose publicly.
func DoSearchPosts ¶
func DoSearchPosts(ctx context.Context, dir identity.Directory, escli *es.Client, index string, params *PostSearchParams) (*EsSearchResponse, error)
func DoSearchProfiles ¶
func DoSearchProfiles(ctx context.Context, dir identity.Directory, escli *es.Client, index string, params *ActorSearchParams) (*EsSearchResponse, error)
func DoSearchProfilesTypeahead ¶
func DoSearchProfilesTypeahead(ctx context.Context, escli *es.Client, index string, params *ActorSearchParams) (*EsSearchResponse, error)
type HealthStatus ¶
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
func NewIndexer ¶
func (*Indexer) BulkIndexPageranks ¶
BulkIndexPageranks updates the pageranks for the DIDs in the Search Index from a CSV file.
func (*Indexer) BulkIndexPosts ¶
BulkIndexPosts indexes posts from a CSV file.
func (*Indexer) BulkIndexProfiles ¶
BulkIndexProfiles indexes profiles from a CSV file.
type IndexerConfig ¶
type PagerankIndexJob ¶
type PagerankIndexJob struct {
// contains filtered or unexported fields
}
type PostDoc ¶
type PostDoc struct { DocIndexTs string `json:"doc_index_ts"` DID string `json:"did"` RecordRkey string `json:"record_rkey"` RecordCID string `json:"record_cid"` CreatedAt *string `json:"created_at,omitempty"` Text string `json:"text"` TextJA *string `json:"text_ja,omitempty"` LangCode []string `json:"lang_code,omitempty"` LangCodeIso2 []string `json:"lang_code_iso2,omitempty"` MentionDID []string `json:"mention_did,omitempty"` EmbedATURI *string `json:"embed_aturi,omitempty"` ReplyRootATURI *string `json:"reply_root_aturi,omitempty"` EmbedImgCount int `json:"embed_img_count"` EmbedImgAltText []string `json:"embed_img_alt_text,omitempty"` EmbedImgAltTextJA []string `json:"embed_img_alt_text_ja,omitempty"` SelfLabel []string `json:"self_label,omitempty"` URL []string `json:"url,omitempty"` Domain []string `json:"domain,omitempty"` Tag []string `json:"tag,omitempty"` Emoji []string `json:"emoji,omitempty"` }
func TransformPost ¶
type PostIndexJob ¶
type PostIndexJob struct {
// contains filtered or unexported fields
}
type PostSearchParams ¶
type PostSearchParams struct { Query string `json:"q"` Sort string `json:"sort"` Author *syntax.DID `json:"author"` Since *syntax.Datetime `json:"since"` Until *syntax.Datetime `json:"until"` Mentions *syntax.DID `json:"mentions"` Lang *syntax.Language `json:"lang"` Domain string `json:"domain"` URL string `json:"url"` Tags []string `json:"tag"` Viewer *syntax.DID `json:"viewer"` Offset int `json:"offset"` Size int `json:"size"` }
func ParsePostQuery ¶
func ParsePostQuery(ctx context.Context, dir identity.Directory, raw string, viewer *syntax.DID) PostSearchParams
ParseQuery takes a query string and pulls out some facet patterns ("from:handle.net") as filters
func (*PostSearchParams) Filters ¶
func (p *PostSearchParams) Filters() []map[string]interface{}
Filters turns search params in to actual elasticsearch/opensearch filter DSL
func (*PostSearchParams) Update ¶
func (p *PostSearchParams) Update(other *PostSearchParams)
Merges params from another param object in to this one. Intended to meld parsed query with HTTP query params, so not all functionality is supported, and priority is with the "current" object
type PostSearchResult ¶
type PostSearchResult struct { Tid string `json:"tid"` Cid string `json:"cid"` User UserResult `json:"user"` Post any `json:"post"` }
type ProfileDoc ¶
type ProfileDoc struct { DocIndexTs string `json:"doc_index_ts"` DID string `json:"did"` RecordCID string `json:"record_cid"` Handle string `json:"handle"` DisplayName *string `json:"display_name,omitempty"` Description *string `json:"description,omitempty"` ImgAltText []string `json:"img_alt_text,omitempty"` SelfLabel []string `json:"self_label,omitempty"` URL []string `json:"url,omitempty"` Domain []string `json:"domain,omitempty"` Tag []string `json:"tag,omitempty"` Emoji []string `json:"emoji,omitempty"` HasAvatar bool `json:"has_avatar"` HasBanner bool `json:"has_banner"` }
func TransformProfile ¶
func TransformProfile(profile *appbsky.ActorProfile, ident *identity.Identity, cid string) ProfileDoc
func (*ProfileDoc) DocId ¶
func (d *ProfileDoc) DocId() string
Returns the search index document ID (`_id`) for this document.
This identifier should be URL safe and not contain a slash ("/").
type ProfileIndexJob ¶
type ProfileIndexJob struct {
// contains filtered or unexported fields
}
type Server ¶
type Server struct { Indexer *Indexer // contains filtered or unexported fields }
func (*Server) RunMetrics ¶
func (*Server) SearchPosts ¶
func (s *Server) SearchPosts(ctx context.Context, params *PostSearchParams) (*appbsky.UnspeccedSearchPostsSkeleton_Output, error)
func (*Server) SearchProfiles ¶
func (s *Server) SearchProfiles(ctx context.Context, params *ActorSearchParams) (*appbsky.UnspeccedSearchActorsSkeleton_Output, error)