Struct tantivy::query::RangeQuery [−][src]
pub struct RangeQuery { /* fields omitted */ }
RangeQuery
match all documents that have at least one term within a defined range.
Matched document will all get a constant Score
of one.
Implementation
The current implement will iterate over the terms within the range
and append all of the document cross into a BitSet
.
Example
let searcher = index.searcher(); let docs_in_the_sixties = RangeQuery::new_u64(year_field, 1960..1970); let mut count_collector = CountCollector::default(); docs_in_the_sixties.search(&searcher, &mut count_collector)?; let num_60s_books = count_collector.count();
Methods
impl RangeQuery
[src]
impl RangeQuery
pub fn new_term_bounds(
field: Field,
value_type: Type,
left_bound: &Bound<Term>,
right_bound: &Bound<Term>
) -> RangeQuery
[src]
pub fn new_term_bounds(
field: Field,
value_type: Type,
left_bound: &Bound<Term>,
right_bound: &Bound<Term>
) -> RangeQuery
Creates a new RangeQuery
from bounded start and end terms.
If the value type is not correct, something may go terribly wrong when
the Weight
object is created.
pub fn new_i64(field: Field, range: Range<i64>) -> RangeQuery
[src]
pub fn new_i64(field: Field, range: Range<i64>) -> RangeQuery
Creates a new RangeQuery
over a i64
field.
If the field is not of the type i64
, tantivy
will panic when the Weight
object is created.
pub fn new_i64_bounds(
field: Field,
left_bound: Bound<i64>,
right_bound: Bound<i64>
) -> RangeQuery
[src]
pub fn new_i64_bounds(
field: Field,
left_bound: Bound<i64>,
right_bound: Bound<i64>
) -> RangeQuery
Create a new RangeQuery
over a i64
field.
The two Bound
arguments make it possible to create more complex
ranges than semi-inclusive range.
If the field is not of the type i64
, tantivy
will panic when the Weight
object is created.
pub fn new_u64_bounds(
field: Field,
left_bound: Bound<u64>,
right_bound: Bound<u64>
) -> RangeQuery
[src]
pub fn new_u64_bounds(
field: Field,
left_bound: Bound<u64>,
right_bound: Bound<u64>
) -> RangeQuery
Create a new RangeQuery
over a u64
field.
The two Bound
arguments make it possible to create more complex
ranges than semi-inclusive range.
If the field is not of the type u64
, tantivy
will panic when the Weight
object is created.
pub fn new_u64(field: Field, range: Range<u64>) -> RangeQuery
[src]
pub fn new_u64(field: Field, range: Range<u64>) -> RangeQuery
Create a new RangeQuery
over a u64
field.
If the field is not of the type u64
, tantivy
will panic when the Weight
object is created.
pub fn new_str_bounds(
field: Field,
left: Bound<&str>,
right: Bound<&str>
) -> RangeQuery
[src]
pub fn new_str_bounds(
field: Field,
left: Bound<&str>,
right: Bound<&str>
) -> RangeQuery
Create a new RangeQuery
over a Str
field.
The two Bound
arguments make it possible to create more complex
ranges than semi-inclusive range.
If the field is not of the type Str
, tantivy
will panic when the Weight
object is created.
pub fn new_str(field: Field, range: Range<&str>) -> RangeQuery
[src]
pub fn new_str(field: Field, range: Range<&str>) -> RangeQuery
Create a new RangeQuery
over a Str
field.
If the field is not of the type Str
, tantivy
will panic when the Weight
object is created.
pub fn field(&self) -> Field
[src]
pub fn field(&self) -> Field
Field to search over
pub fn left_bound(&self) -> Bound<Term>
[src]
pub fn left_bound(&self) -> Bound<Term>
Lower bound of range
pub fn right_bound(&self) -> Bound<Term>
[src]
pub fn right_bound(&self) -> Bound<Term>
Upper bound of range
Trait Implementations
impl Clone for RangeQuery
[src]
impl Clone for RangeQuery
fn clone(&self) -> RangeQuery
[src]
fn clone(&self) -> RangeQuery
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for RangeQuery
[src]
impl Debug for RangeQuery
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Query for RangeQuery
[src]
impl Query for RangeQuery
fn weight(
&self,
searcher: &Searcher,
_scoring_enabled: bool
) -> Result<Box<Weight>>
[src]
fn weight(
&self,
searcher: &Searcher,
_scoring_enabled: bool
) -> Result<Box<Weight>>
Create the weight associated to a query. Read more
fn count(&self, searcher: &Searcher) -> Result<usize>
[src]
fn count(&self, searcher: &Searcher) -> Result<usize>
Returns the number of documents matching the query.
fn query_terms(&self, _term_set: &mut BTreeSet<Term>)
[src]
fn query_terms(&self, _term_set: &mut BTreeSet<Term>)
Extract all of the terms associated to the query and insert them in the term set given in arguments. Read more
fn search(&self, searcher: &Searcher, collector: &mut Collector) -> Result<()>
[src]
fn search(&self, searcher: &Searcher, collector: &mut Collector) -> Result<()>
Search works as follows : Read more
Auto Trait Implementations
impl Send for RangeQuery
impl Send for RangeQuery
impl Sync for RangeQuery
impl Sync for RangeQuery