mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-07 17:42:55 +00:00
Removed half baked usage of Any
This commit is contained in:
@@ -6,7 +6,6 @@ use Result;
|
||||
use DocSet;
|
||||
use Score;
|
||||
use DocId;
|
||||
use std::any::Any;
|
||||
use core::Searcher;
|
||||
|
||||
/// Query that matches all of the documents.
|
||||
@@ -16,10 +15,6 @@ use core::Searcher;
|
||||
pub struct AllQuery;
|
||||
|
||||
impl Query for AllQuery {
|
||||
fn as_any(&self) -> &Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn weight(&self, _: &Searcher, _: bool) -> Result<Box<Weight>> {
|
||||
Ok(box AllWeight)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use Result;
|
||||
use std::any::Any;
|
||||
use super::boolean_weight::BooleanWeight;
|
||||
use query::Weight;
|
||||
use Searcher;
|
||||
@@ -33,10 +32,6 @@ impl From<Vec<(Occur, Box<Query>)>> for BooleanQuery {
|
||||
}
|
||||
|
||||
impl Query for BooleanQuery {
|
||||
fn as_any(&self) -> &Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn weight(&self, searcher: &Searcher, scoring_enabled: bool) -> Result<Box<Weight>> {
|
||||
let sub_weights = self.subqueries
|
||||
.iter()
|
||||
|
||||
@@ -2,7 +2,6 @@ use schema::Term;
|
||||
use query::Query;
|
||||
use core::searcher::Searcher;
|
||||
use super::PhraseWeight;
|
||||
use std::any::Any;
|
||||
use query::Weight;
|
||||
use Result;
|
||||
|
||||
@@ -26,12 +25,6 @@ pub struct PhraseQuery {
|
||||
}
|
||||
|
||||
impl Query for PhraseQuery {
|
||||
/// Used to make it possible to cast Box<Query>
|
||||
/// into a specific type. This is mostly useful for unit tests.
|
||||
fn as_any(&self) -> &Any {
|
||||
self
|
||||
}
|
||||
|
||||
/// Create the weight associated to a query.
|
||||
///
|
||||
/// See [`Weight`](./trait.Weight.html).
|
||||
|
||||
@@ -5,7 +5,6 @@ use common::TimerTree;
|
||||
use SegmentLocalId;
|
||||
use super::Weight;
|
||||
use std::fmt;
|
||||
use std::any::Any;
|
||||
|
||||
/// The `Query` trait defines a set of documents and a scoring method
|
||||
/// for those documents.
|
||||
@@ -41,9 +40,6 @@ use std::any::Any;
|
||||
/// When implementing a new type of `Query`, it is normal to implement a
|
||||
/// dedicated `Query`, `Weight` and `Scorer`.
|
||||
pub trait Query: fmt::Debug {
|
||||
/// Used to make it possible to cast Box<Query>
|
||||
/// into a specific type. This is mostly useful for unit tests.
|
||||
fn as_any(&self) -> &Any;
|
||||
|
||||
/// Create the weight associated to a query.
|
||||
///
|
||||
|
||||
@@ -4,7 +4,6 @@ use termdict::{TermDictionary, TermStreamer, TermStreamerBuilder};
|
||||
use core::SegmentReader;
|
||||
use common::BitSet;
|
||||
use Result;
|
||||
use std::any::Any;
|
||||
use core::Searcher;
|
||||
use query::BitSetDocSet;
|
||||
use query::ConstScorer;
|
||||
@@ -129,10 +128,6 @@ impl RangeQuery {
|
||||
}
|
||||
|
||||
impl Query for RangeQuery {
|
||||
fn as_any(&self) -> &Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn weight(&self, _searcher: &Searcher, _scoring_enabled: bool) -> Result<Box<Weight>> {
|
||||
Ok(box RangeWeight {
|
||||
field: self.field,
|
||||
|
||||
@@ -5,7 +5,6 @@ use query::Query;
|
||||
use query::Weight;
|
||||
use schema::IndexRecordOption;
|
||||
use Searcher;
|
||||
use std::any::Any;
|
||||
|
||||
/// A Term query matches all of the documents
|
||||
/// containing a specific term.
|
||||
@@ -53,10 +52,6 @@ impl TermQuery {
|
||||
}
|
||||
|
||||
impl Query for TermQuery {
|
||||
fn as_any(&self) -> &Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn weight(&self, searcher: &Searcher, scoring_enabled: bool) -> Result<Box<Weight>> {
|
||||
Ok(box self.specialized_weight(searcher, scoring_enabled))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user