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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more