Skip to content

Apache Lucene open-source search software

Remove QueryWrapper

Mark Robert Miller4244f6c13adc
diff --git a/src/java/org/apache/solr/schema/TrieDateField.java b/src/java/org/apache/solr/schema/TrieDateField.java
index b89ef934e11..029d935ca5f 100755
--- a/src/java/org/apache/solr/schema/TrieDateField.java
+++ b/src/java/org/apache/solr/schema/TrieDateField.java
@@ -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;
}
}
diff --git a/src/java/org/apache/solr/schema/TrieField.java b/src/java/org/apache/solr/schema/TrieField.java
index ab0db1eb14c..bbe87f7f6df 100644
--- a/src/java/org/apache/solr/schema/TrieField.java
+++ b/src/java/org/apache/solr/schema/TrieField.java
@@ -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;
}
diff --git a/src/java/org/apache/solr/search/QueryParsing.java b/src/java/org/apache/solr/search/QueryParsing.java
index 77a1dd749d4..a3afeb11556 100644
--- a/src/java/org/apache/solr/search/QueryParsing.java
+++ b/src/java/org/apache/solr/search/QueryParsing.java
@@ -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() + ')' );
diff --git a/src/java/org/apache/solr/search/SolrQueryWrapper.java b/src/java/org/apache/solr/search/SolrQueryWrapper.java
deleted file mode 100644
index 48b048dfafd..00000000000
--- a/src/java/org/apache/solr/search/SolrQueryWrapper.java
+++ /dev/null
@@ -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();
- }
-}