pub struct WorksQuery {
pub free_form_queries: Vec<String>,
pub field_queries: Vec<FieldQuery>,
pub filter: Vec<WorksFilter>,
pub sort: Option<Sort>,
pub order: Option<Order>,
pub facets: Vec<FacetCount>,
pub result_control: Option<WorkResultControl>,
pub sample: Option<usize>,
}
Expand description
Fields§
§free_form_queries: Vec<String>
search by non specific query
field_queries: Vec<FieldQuery>
match only particular fields of metadata
filter: Vec<WorksFilter>
filter to apply while querying
sort: Option<Sort>
sort results by a certain field and
order: Option<Order>
set the sort order to asc
or desc
facets: Vec<FacetCount>
enable facet information in responses
result_control: Option<WorkResultControl>
deep page through /works
result sets
sample: Option<usize>
request random dois if set all other parameters are ignored
Implementations§
Source§impl WorksQuery
impl WorksQuery
Sourcepub fn random(len: usize) -> Self
pub fn random(len: usize) -> Self
creates an new WorksQuery
with the desired sample size that will result in
a request for random dois
Sourcepub fn new<T: ToString>(query: T) -> Self
pub fn new<T: ToString>(query: T) -> Self
Convenience method to create a new WorksQuery
with a term directly
Sourcepub fn field_query(self, query: FieldQuery) -> Self
pub fn field_query(self, query: FieldQuery) -> Self
add a new field query form query
Sourcepub fn field_queries(self, queries: Vec<FieldQuery>) -> Self
pub fn field_queries(self, queries: Vec<FieldQuery>) -> Self
use crossref::{FieldQuery,WorksQuery};
let query = WorksQuery::default().field_queries(vec![FieldQuery::title("room at the bottom"), FieldQuery::author("richard feynman")]);
add a bunch of free form query terms
Sourcepub fn filter(self, filter: WorksFilter) -> Self
pub fn filter(self, filter: WorksFilter) -> Self
add a new filter to the query
Sourcepub fn facet(self, facet: FacetCount) -> Self
pub fn facet(self, facet: FacetCount) -> Self
add another facet to query
Sourcepub fn next_cursor(self, cursor: &str) -> Self
pub fn next_cursor(self, cursor: &str) -> Self
set the cursor for result control deep paging
Sourcepub fn new_cursor(self) -> Self
pub fn new_cursor(self) -> Self
set an empty cursor
Sourcepub fn result_control(self, result_control: WorkResultControl) -> Self
pub fn result_control(self, result_control: WorkResultControl) -> Self
set result control option to query
Sourcepub fn into_combined<W: WorksCombiner>(self, id: &str) -> W
pub fn into_combined<W: WorksCombiner>(self, id: &str) -> W
Sourcepub fn into_ident(self, id: &str) -> WorksIdentQuery
pub fn into_ident(self, id: &str) -> WorksIdentQuery
Bind the query to a specific id of a primary endpoint element
Sourcepub fn into_combined_query<W: WorksCombiner>(self, id: &str) -> WorkListQuery
pub fn into_combined_query<W: WorksCombiner>(self, id: &str) -> WorkListQuery
wrap this query in new WorkListQuery
that targets the /works
route of a primary component with an id.
The query will evaluate to the same as [into_combined
]
§Example
Create a query that targets all Works
of a funder with id funder id
let query = WorksQuery::default()
.into_combined_query::<Funders>("funder id");
Trait Implementations§
Source§impl Clone for WorksQuery
impl Clone for WorksQuery
Source§fn clone(&self) -> WorksQuery
fn clone(&self) -> WorksQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl CrossrefParams for WorksQuery
impl CrossrefParams for WorksQuery
Source§type Filter = WorksFilter
type Filter = WorksFilter
Source§fn query_terms(&self) -> &[String]
fn query_terms(&self) -> &[String]
Source§fn facets(&self) -> &[FacetCount]
fn facets(&self) -> &[FacetCount]
Source§fn result_control(&self) -> Option<&ResultControl>
fn result_control(&self) -> Option<&ResultControl>
Source§impl CrossrefRoute for WorksQuery
impl CrossrefRoute for WorksQuery
Source§impl Debug for WorksQuery
impl Debug for WorksQuery
Source§impl Default for WorksQuery
impl Default for WorksQuery
Source§fn default() -> WorksQuery
fn default() -> WorksQuery
Source§impl Into<WorkListQuery> for WorksQuery
impl Into<WorkListQuery> for WorksQuery
Source§fn into(self) -> WorkListQuery
fn into(self) -> WorkListQuery
Auto Trait Implementations§
impl Freeze for WorksQuery
impl RefUnwindSafe for WorksQuery
impl Send for WorksQuery
impl Sync for WorksQuery
impl Unpin for WorksQuery
impl UnwindSafe for WorksQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more