Remove QueryWrapper

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@882619 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-11-20 15:55:00 +00:00
parent 1ac71a2aaf
commit 4244f6c13a
4 changed files with 2 additions and 128 deletions

View File

@ -24,7 +24,6 @@ import org.apache.solr.analysis.TokenizerChain;
import org.apache.solr.analysis.TrieTokenizerFactory;
import org.apache.solr.search.function.*;
import org.apache.solr.search.QParser;
import org.apache.solr.search.SolrQueryWrapper;
import org.apache.solr.request.XMLWriter;
import org.apache.solr.request.TextResponseWriter;
import org.apache.lucene.document.Fieldable;
@ -205,9 +204,6 @@ public class TrieDateField extends DateField {
max == null ? null : max.getTime(),
minInclusive, maxInclusive);
// NumericRangeQuery extends MultiTermQuery but returns null for getTerm() which currently breaks
// the span based highlighter in Lucene 2.9.0. Wrapping the query prevents the highlighter
// from calling getTerm()
return new SolrQueryWrapper(query);
return query;
}
}

View File

@ -22,19 +22,16 @@ import org.apache.lucene.search.*;
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.NumericTokenStream;
import org.apache.lucene.index.IndexReader;
import org.apache.solr.analysis.*;
import org.apache.solr.common.SolrException;
import org.apache.solr.request.TextResponseWriter;
import org.apache.solr.request.XMLWriter;
import org.apache.solr.search.QParser;
import org.apache.solr.search.SolrQueryWrapper;
import org.apache.solr.search.function.*;
import java.io.IOException;
import java.util.Map;
import java.util.Date;
import java.util.Set;
/**
* Provides field types to support for Lucene's Trie Range Queries.
@ -265,10 +262,7 @@ public class TrieField extends FieldType {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field");
}
// NumericRangeQuery extends MultiTermQuery but returns null for getTerm() which currently breaks
// the span based highlighter in Lucene 2.9.0. Wrapping the query prevents the highlighter
// from calling getTerm()
return new SolrQueryWrapper(query);
return query;
}

View File

@ -29,7 +29,6 @@ import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.schema.FieldType;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.search.SolrQueryWrapper;
import org.apache.solr.search.function.FunctionQuery;
import java.io.IOException;
@ -441,9 +440,6 @@ public class QueryParsing {
} else if (query instanceof ConstantScoreQuery) {
out.append(query.toString());
writeBoost=false;
} else if (query instanceof SolrQueryWrapper) {
toString(((SolrQueryWrapper)query).getWrappedQuery(), schema, out, flags);
return;
} else {
out.append(query.getClass().getSimpleName()
+ '(' + query.toString() + ')' );

View File

@ -1,112 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.search;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.index.IndexReader;
import java.io.IOException;
import java.util.Set;
public class SolrQueryWrapper extends Query {
private final Query q;
public SolrQueryWrapper(Query q) {
this.q = q;
}
public Query getWrappedQuery() {
return q;
}
@Override
public void setBoost(float b) {
q.setBoost(b);
}
@Override
public float getBoost() {
return q.getBoost();
}
@Override
public String toString() {
return q.toString();
}
@Override
public Weight createWeight(Searcher searcher) throws IOException {
return q.createWeight(searcher);
}
@Override
public Weight weight(Searcher searcher) throws IOException {
return q.weight(searcher);
}
@Override
public Query rewrite(IndexReader reader) throws IOException {
return q.rewrite(reader);
}
@Override
public Query combine(Query[] queries) {
return q.combine(queries);
}
@Override
public void extractTerms(Set terms) {
q.extractTerms(terms);
}
@Override
public Similarity getSimilarity(Searcher searcher) {
return q.getSimilarity(searcher);
}
@Override
public Object clone() {
return new SolrQueryWrapper((Query)q.clone());
}
@Override
public int hashCode() {
return q.hashCode();
}
@Override
public boolean equals(Object obj) {
Query other;
if (obj instanceof SolrQueryWrapper) {
other = ((SolrQueryWrapper)obj).q;
} else if (obj instanceof Query) {
other = (Query)obj;
} else {
return false;
}
return q.equals(other);
}
@Override
public String toString(String field) {
return q.toString();
}
}