Perplexed.Search.Result (Perplexed v0.2.0)

Copy Markdown View Source

One search call: the hits, the provider that answered, and what it cost.

provider is the name of the provider that answered (a built-in name or the module, never a spec's options). cost is its list price in USD for this request, or for a fallback chain the sum of every attempt's cost. A request that returned nothing still costs that price, unless the provider reports empty results as free (Perplexed.Search.free_when_empty?/0). scrape_cost is the summed cost of the hits' documents when the search ran with scrape: true. total_cost is both together. attempts lists each provider a fallback chain tried (see Perplexed.Search.Fallback), and is empty for a single provider.

Summary

Types

t()

@type t() :: %Perplexed.Search.Result{
  attempts: [Perplexed.Search.Fallback.attempt()],
  cost: float(),
  hits: [Perplexed.Search.Hit.t()],
  provider: Perplexed.Search.spec(),
  query: String.t(),
  scrape_cost: float(),
  total_cost: float()
}