Removed half baked usage of Any

This commit is contained in:
Paul Masurel
2018-02-18 10:01:14 +09:00
parent 6c8c90d348
commit e608e0a1df
6 changed files with 0 additions and 31 deletions

View File

@@ -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)
}

View File

@@ -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()

View File

@@ -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).

View File

@@ -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.
///

View File

@@ -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,

View File

@@ -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))
}