Documentation
¶
Index ¶
- Constants
- func FindFullText(req common.FindFullTextRequest) (*common.FindFullTextResponse, error)
- func GetCitations(req common.GetCitationsRequest) (*common.GetCitationsResponse, error)
- func GetMetrics(req common.GetMetricsRequest) (*common.Metrics, error)
- func ResolveDOI(req common.ResolveDOIRequest) (*common.Work, error)
- func Search(ctx context.Context, query *querydsl.Query, opts SearchOptions) ([]common.SearchResult, error)
- func SuggestKeywords(req common.SuggestKeywordsRequest) (*common.SuggestKeywordsResponse, error)
- type ArxivPaper
- type OpenAlexConceptResponse
- type OpenAlexTextRequest
- type RerankerClient
- type RerankerRequest
- type RerankerResponse
- type ScoredPaper
- type SearchOptions
- type SearchProvider
- type UnpaywallResponse
Constants ¶
const ( // DefaultRerankerURL is the default URL for the reranker service DefaultRerankerURL = "http://localhost:8000/rerank" // DefaultRerankerTimeout is the default timeout for reranker requests DefaultRerankerTimeout = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func FindFullText ¶
func FindFullText(req common.FindFullTextRequest) (*common.FindFullTextResponse, error)
FindFullText finds the best PDF or HTML URL for a work
func GetCitations ¶
func GetCitations(req common.GetCitationsRequest) (*common.GetCitationsResponse, error)
GetCitations retrieves one hop of the citation graph
func GetMetrics ¶
func GetMetrics(req common.GetMetricsRequest) (*common.Metrics, error)
GetMetrics retrieves quantitative metrics for a work
func ResolveDOI ¶
func ResolveDOI(req common.ResolveDOIRequest) (*common.Work, error)
ResolveDOI fetches complete metadata for a DOI from both Crossref and OpenAlex and merges them into a single rich record
func Search ¶
func Search(ctx context.Context, query *querydsl.Query, opts SearchOptions) ([]common.SearchResult, error)
Search performs a unified search across multiple providers using the query DSL
func SuggestKeywords ¶
func SuggestKeywords(req common.SuggestKeywordsRequest) (*common.SuggestKeywordsResponse, error)
SuggestKeywords suggests keywords for the given text using OpenAlex's text-aboutness endpoint
Types ¶
type ArxivPaper ¶
type ArxivPaper struct { Title string `json:"Title"` Authors []string `json:"Authors"` Abstract string `json:"Abstract"` Published string `json:"Published"` DOI string `json:"DOI,omitempty"` PDFURL string `json:"PDFURL,omitempty"` SourceURL string `json:"SourceURL,omitempty"` SourceName string `json:"SourceName,omitempty"` OAStatus string `json:"OAStatus,omitempty"` License string `json:"License,omitempty"` FileSize string `json:"FileSize,omitempty"` Citations int `json:"Citations,omitempty"` Type string `json:"Type,omitempty"` JournalInfo string `json:"JournalInfo,omitempty"` Metadata map[string]interface{} `json:"Metadata,omitempty"` }
ArxivPaper represents a paper in the reranker request
type OpenAlexConceptResponse ¶
type OpenAlexConceptResponse struct { Concepts []struct { ID string `json:"id"` DisplayName string `json:"display_name"` Score float64 `json:"score"` } `json:"concepts"` }
OpenAlexConceptResponse represents the response from OpenAlex text-aboutness
type OpenAlexTextRequest ¶
type OpenAlexTextRequest struct {
Title string `json:"title"`
}
OpenAlexTextRequest represents the request body for OpenAlex text-aboutness
type RerankerClient ¶
type RerankerClient struct { URL string Timeout time.Duration // contains filtered or unexported fields }
RerankerClient provides methods to interact with the reranker service
func NewRerankerClient ¶
func NewRerankerClient(url string, timeout time.Duration) *RerankerClient
NewRerankerClient creates a new client for the reranker service
func (*RerankerClient) IsRerankerAvailable ¶
func (c *RerankerClient) IsRerankerAvailable(ctx context.Context) bool
IsRerankerAvailable checks if the reranker service is available
func (*RerankerClient) Rerank ¶
func (c *RerankerClient) Rerank(ctx context.Context, query string, results []common.SearchResult, topN int) ([]common.SearchResult, error)
Rerank sends a reranking request to the reranker service
type RerankerRequest ¶
type RerankerRequest struct { Query string `json:"query"` Results []ArxivPaper `json:"results"` TopN int `json:"top_n,omitempty"` }
RerankerRequest represents a request to the reranker service
type RerankerResponse ¶
type RerankerResponse struct { Query string `json:"query"` RerankedResults []ScoredPaper `json:"reranked_results"` }
RerankerResponse represents a response from the reranker service
type ScoredPaper ¶
type ScoredPaper struct { ArxivPaper Score float64 `json:"score"` }
ScoredPaper represents a paper with a reranker score
type SearchOptions ¶
type SearchOptions struct { Providers []SearchProvider // which providers to search (default: all) Mailto string // email for polite pool access UseReranker bool // whether to use the reranker (default: true) }
SearchOptions configures a multi-provider search
type SearchProvider ¶
type SearchProvider string
SearchProvider represents a source that can be searched
const ( ProviderArxiv SearchProvider = "arxiv" ProviderCrossref SearchProvider = "crossref" ProviderOpenAlex SearchProvider = "openalex" )
type UnpaywallResponse ¶
type UnpaywallResponse struct { BestOALocation struct { URL string `json:"url"` URLForPDF string `json:"url_for_pdf,omitempty"` VersionType string `json:"version"` License string `json:"license"` HostType string `json:"host_type"` IsPDF bool `json:"is_pdf"` } `json:"best_oa_location"` IsOA bool `json:"is_oa"` OAStatus string `json:"oa_status"` OALocations []struct { URL string `json:"url"` URLForPDF string `json:"url_for_pdf,omitempty"` VersionType string `json:"version"` License string `json:"license"` HostType string `json:"host_type"` IsPDF bool `json:"is_pdf"` } `json:"oa_locations"` }
UnpaywallResponse represents the Unpaywall API response