Skip to main content

SearchParams

Struct SearchParams 

Source
#[non_exhaustive]
pub struct SearchParams {
Show 26 fields pub query: Option<String>, pub sources: Option<Vec<String>>, pub opt_in_sources: Option<Vec<String>>, pub exclude_sources: Option<Vec<String>>, pub source_types: Option<Vec<SourceType>>, pub exclude_source_types: Option<Vec<SourceType>>, pub from: Option<DateInput>, pub to: Option<DateInput>, pub languages: Option<Vec<String>>, pub tickers: Option<Vec<String>>, pub countries: Option<Vec<String>>, pub categories: Option<Vec<String>>, pub has_content: Option<bool>, pub roles: Option<Vec<CompanyRole>>, pub min_relevance: Option<f64>, pub event_types: Option<Vec<EventType>>, pub event_directions: Option<Vec<EventDirection>>, pub min_importance: Option<Importance>, pub sectors: Option<Vec<String>>, pub company_countries: Option<Vec<String>>, pub exchanges: Option<Vec<String>>, pub order_by: Option<OrderBy>, pub order: Option<SortOrder>, pub limit: Option<u32>, pub cursor: Option<String>, pub include: Option<Vec<IncludeBlock>>,
}
Expand description

Parameters of articles().search() and articles().search_all().

use finlight::{IncludeBlock, SearchParams};
let params = SearchParams::new()
    .query("ticker:NVDA")
    .languages(["en"])
    .include([IncludeBlock::COMPANIES, IncludeBlock::EVENTS])
    .limit(10);

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§query: Option<String>

Query language, e.g. ticker:AAPL AND eventType:earnings.

§sources: Option<Vec<String>>

Only these source domains.

§opt_in_sources: Option<Vec<String>>

Non-default sources added to the default pool.

§exclude_sources: Option<Vec<String>>

Source domains left out.

§source_types: Option<Vec<SourceType>>

Only sources of these types. Articles of unclassified sources never match.

§exclude_source_types: Option<Vec<SourceType>>

Source types left out. Articles of unclassified sources are kept.

§from: Option<DateInput>

Lower bound of the order_by timestamp.

§to: Option<DateInput>

Upper bound of the order_by timestamp.

§languages: Option<Vec<String>>

ISO 639-1 codes; not empty. The server default is ["en"].

§tickers: Option<Vec<String>>

Tickers (SYMBOL, SYMBOL@MIC, vendor notations).

§countries: Option<Vec<String>>

Geographic focus of the story (ISO alpha-2).

§categories: Option<Vec<String>>

Categories.

§has_content: Option<bool>

true keeps only articles with scraped content.

§roles: Option<Vec<CompanyRole>>

Company roles (same company as tickers and min_relevance).

§min_relevance: Option<f64>

Minimum relevance, 0 to 1.

§event_types: Option<Vec<EventType>>

Event types (same event as event_directions and min_importance).

§event_directions: Option<Vec<EventDirection>>

Event directions.

§min_importance: Option<Importance>

Minimum event importance.

§sectors: Option<Vec<String>>

GICS sectors.

§company_countries: Option<Vec<String>>

Company domicile (ISO alpha-2).

§exchanges: Option<Vec<String>>

Primary-listing MICs.

§order_by: Option<OrderBy>

Sort timestamp (and the timestamp from and to apply to).

§order: Option<SortOrder>

Sort direction.

§limit: Option<u32>

Page size, 1 to 100. The server default is 20.

§cursor: Option<String>

pagination.next_cursor of the previous page.

§include: Option<Vec<IncludeBlock>>

Extra blocks (at most 3).

Implementations§

Source§

impl SearchParams

Source

pub fn new() -> Self

Empty parameters (an empty search sends {}).

Source

pub fn from_json(json: &str) -> Result<Self>

Reads parameters from a JSON object with the wire keys (eventTypes, orderBy, …). An unknown key is rejected with Error::Validation naming it.

Source

pub fn query(self, value: impl Into<String>) -> Self

Query language.

Source

pub fn cursor(self, value: impl Into<String>) -> Self

Cursor of the previous page.

Source

pub fn sources<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Only these source domains.

Source

pub fn opt_in_sources<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Non-default sources added to the default pool.

Source

pub fn exclude_sources<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source domains left out.

Source

pub fn languages<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

ISO 639-1 codes.

Source

pub fn tickers<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Tickers.

Source

pub fn countries<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Story countries.

Source

pub fn categories<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Categories.

Source

pub fn sectors<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

GICS sectors.

Source

pub fn company_countries<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Company domicile countries.

Source

pub fn exchanges<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Primary-listing MICs.

Source

pub fn source_types<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<SourceType>,

Only sources of these types (SourceType::NEWSWIRE, …).

Source

pub fn exclude_source_types<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<SourceType>,

Source types left out.

Source

pub fn roles<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<CompanyRole>,

Company roles.

Source

pub fn event_types<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<EventType>,

Event types.

Source

pub fn event_directions<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<EventDirection>,

Event directions.

Source

pub fn include<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<IncludeBlock>,

Extra blocks.

Source

pub fn has_content(self, value: bool) -> Self

Only articles with scraped content.

Source

pub fn from(self, value: impl Into<DateInput>) -> Self

Lower bound (a SystemTime, DateInput::date(..) or a string).

Source

pub fn to(self, value: impl Into<DateInput>) -> Self

Upper bound.

Source

pub fn min_relevance(self, value: f64) -> Self

Minimum relevance, 0 to 1.

Source

pub fn min_importance(self, value: impl Into<Importance>) -> Self

Minimum event importance.

Source

pub fn order_by(self, value: impl Into<OrderBy>) -> Self

Sort timestamp.

Source

pub fn order(self, value: impl Into<SortOrder>) -> Self

Sort direction.

Source

pub fn limit(self, value: u32) -> Self

Page size, 1 to 100.

Trait Implementations§

Source§

impl Clone for SearchParams

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SearchParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SearchParams

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SearchParams

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SearchParams

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SearchParams

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more