1 package org.apache.lucene.search;
3 import org.apache.lucene.index.FieldInvertState;
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
22 /** Expert: Delegating scoring implementation. Useful in {@link
23 * Query#getSimilarity(Searcher)} implementations, to override only certain
24 * methods of a Searcher's Similarity implementation..
25 * @deprecated this class will be removed in 4.0. Please
26 * subclass {@link Similarity} or {@link DefaultSimilarity} instead. */
28 public class SimilarityDelegator extends Similarity {
30 private Similarity delegee;
32 /** Construct a {@link Similarity} that delegates all methods to another.
34 * @param delegee the Similarity implementation to delegate to
36 public SimilarityDelegator(Similarity delegee) {
37 this.delegee = delegee;
41 public float computeNorm(String fieldName, FieldInvertState state) {
42 return delegee.computeNorm(fieldName, state);
46 public float queryNorm(float sumOfSquaredWeights) {
47 return delegee.queryNorm(sumOfSquaredWeights);
51 public float tf(float freq) {
52 return delegee.tf(freq);
56 public float sloppyFreq(int distance) {
57 return delegee.sloppyFreq(distance);
61 public float idf(int docFreq, int numDocs) {
62 return delegee.idf(docFreq, numDocs);
66 public float coord(int overlap, int maxOverlap) {
67 return delegee.coord(overlap, maxOverlap);
71 public float scorePayload(int docId, String fieldName, int start, int end, byte [] payload, int offset, int length) {
72 return delegee.scorePayload(docId, fieldName, start, end, payload, offset, length);