1 package org.apache.lucene.search;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import java.io.IOException;
22 import org.apache.lucene.document.Document;
23 import org.apache.lucene.document.FieldSelector;
24 import org.apache.lucene.index.CorruptIndexException;
25 import org.apache.lucene.index.IndexReader;
26 import org.apache.lucene.index.FieldInvertState;
27 import org.apache.lucene.index.Term;
28 import org.apache.lucene.util.PriorityQueue;
31 * Holds all implementations of classes in the o.a.l.search package as a
32 * back-compatibility test. It does not run any tests per-se, however if
33 * someone adds a method to an interface or abstract method to an abstract
34 * class, one of the implementations here will fail to compile and so we know
35 * back-compat policy was violated.
37 final class JustCompileSearch {
39 private static final String UNSUPPORTED_MSG = "unsupported: used for back-compat testing only !";
41 static final class JustCompileSearcher extends Searcher {
44 public Weight createNormalizedWeight(Query query) throws IOException {
45 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
49 public void close() throws IOException {
50 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
54 public Document doc(int i) throws CorruptIndexException, IOException {
55 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
59 public int[] docFreqs(Term[] terms) throws IOException {
60 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
64 public Explanation explain(Query query, int doc) throws IOException {
65 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
69 public Similarity getSimilarity() {
70 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
74 public void search(Query query, Collector results) throws IOException {
75 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
79 public void search(Query query, Filter filter, Collector results)
81 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
85 public TopDocs search(Query query, Filter filter, int n) throws IOException {
86 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
90 public TopFieldDocs search(Query query, Filter filter, int n, Sort sort)
92 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
96 public TopDocs search(Query query, int n) throws IOException {
97 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
101 public void setSimilarity(Similarity similarity) {
102 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
106 public int docFreq(Term term) throws IOException {
107 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
111 public Explanation explain(Weight weight, int doc) throws IOException {
112 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
116 public int maxDoc() throws IOException {
117 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
121 public Query rewrite(Query query) throws IOException {
122 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
126 public void search(Weight weight, Filter filter, Collector results)
128 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
132 public TopDocs search(Weight weight, Filter filter, int n)
134 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
138 public TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort)
140 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
144 public Document doc(int n, FieldSelector fieldSelector)
145 throws CorruptIndexException, IOException {
146 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
151 static final class JustCompileCollector extends Collector {
154 public void collect(int doc) throws IOException {
155 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
159 public void setNextReader(IndexReader reader, int docBase)
161 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
165 public void setScorer(Scorer scorer) throws IOException {
166 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
170 public boolean acceptsDocsOutOfOrder() {
171 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
176 static final class JustCompileDocIdSet extends DocIdSet {
179 public DocIdSetIterator iterator() throws IOException {
180 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
185 static final class JustCompileDocIdSetIterator extends DocIdSetIterator {
189 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
193 public int nextDoc() throws IOException {
194 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
198 public int advance(int target) throws IOException {
199 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
203 static final class JustCompileExtendedFieldCacheLongParser implements FieldCache.LongParser {
205 public long parseLong(String string) {
206 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
211 static final class JustCompileExtendedFieldCacheDoubleParser implements FieldCache.DoubleParser {
213 public double parseDouble(String string) {
214 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
219 static final class JustCompileFieldComparator extends FieldComparator<Object> {
222 public int compare(int slot1, int slot2) {
223 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
227 public int compareBottom(int doc) throws IOException {
228 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
232 public void copy(int slot, int doc) throws IOException {
233 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
237 public void setBottom(int slot) {
238 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
242 public void setNextReader(IndexReader reader, int docBase)
244 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
248 public Object value(int slot) {
249 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
254 static final class JustCompileFieldComparatorSource extends FieldComparatorSource {
257 public FieldComparator newComparator(String fieldname, int numHits,
258 int sortPos, boolean reversed) throws IOException {
259 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
264 static final class JustCompileFilter extends Filter {
265 // Filter is just an abstract class with no abstract methods. However it is
266 // still added here in case someone will add abstract methods in the future.
269 public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
274 static final class JustCompileFilteredDocIdSet extends FilteredDocIdSet {
276 public JustCompileFilteredDocIdSet(DocIdSet innerSet) {
281 protected boolean match(int docid) {
282 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
287 static final class JustCompileFilteredDocIdSetIterator extends FilteredDocIdSetIterator {
289 public JustCompileFilteredDocIdSetIterator(DocIdSetIterator innerIter) {
294 protected boolean match(int doc) {
295 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
300 static final class JustCompileFilteredTermEnum extends FilteredTermEnum {
303 public float difference() {
304 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
308 protected boolean endEnum() {
309 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
313 protected boolean termCompare(Term term) {
314 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
319 static final class JustCompilePhraseScorer extends PhraseScorer {
321 JustCompilePhraseScorer(Weight weight, PhraseQuery.PostingsAndFreq[] postings,
322 Similarity similarity, byte[] norms) {
323 super(weight, postings, similarity, norms);
327 protected float phraseFreq() throws IOException {
328 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
333 static final class JustCompileQuery extends Query {
336 public String toString(String field) {
337 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
342 static final class JustCompileScorer extends Scorer {
344 protected JustCompileScorer(Weight weight) {
349 protected boolean score(Collector collector, int max, int firstDocID)
351 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
355 public float score() throws IOException {
356 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
361 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
365 public int nextDoc() throws IOException {
366 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
370 public int advance(int target) throws IOException {
371 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
375 static final class JustCompileSimilarity extends Similarity {
378 public float coord(int overlap, int maxOverlap) {
379 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
383 public float idf(int docFreq, int numDocs) {
384 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
388 public float computeNorm(String fieldName, FieldInvertState state) {
389 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
393 public float queryNorm(float sumOfSquaredWeights) {
394 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
398 public float sloppyFreq(int distance) {
399 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
403 public float tf(float freq) {
404 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
409 static final class JustCompileSpanFilter extends SpanFilter {
412 public SpanFilterResult bitSpans(IndexReader reader) throws IOException {
413 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
417 public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
422 static final class JustCompileTopDocsCollector extends TopDocsCollector<ScoreDoc> {
424 protected JustCompileTopDocsCollector(PriorityQueue<ScoreDoc> pq) {
429 public void collect(int doc) throws IOException {
430 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
434 public void setNextReader(IndexReader reader, int docBase)
436 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
440 public void setScorer(Scorer scorer) throws IOException {
441 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
445 public boolean acceptsDocsOutOfOrder() {
446 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
450 public TopDocs topDocs() {
451 throw new UnsupportedOperationException( UNSUPPORTED_MSG );
455 public TopDocs topDocs( int start ) {
456 throw new UnsupportedOperationException( UNSUPPORTED_MSG );
460 public TopDocs topDocs( int start, int end ) {
461 throw new UnsupportedOperationException( UNSUPPORTED_MSG );
466 static final class JustCompileWeight extends Weight {
469 public Explanation explain(IndexReader reader, int doc) throws IOException {
470 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
474 public Query getQuery() {
475 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
479 public float getValue() {
480 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
484 public void normalize(float norm) {
485 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
489 public float sumOfSquaredWeights() throws IOException {
490 throw new UnsupportedOperationException(UNSUPPORTED_MSG);
494 public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer)
496 throw new UnsupportedOperationException(UNSUPPORTED_MSG);