2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.apache.lucene.benchmark.quality;
19 import java.io.PrintWriter;
22 * Judge if a document is relevant for a quality query.
24 public interface Judge {
27 * Judge if document <code>docName</code> is relevant for the given quality query.
28 * @param docName name of doc tested for relevancy.
29 * @param query tested quality query.
30 * @return true if relevant, false if not.
32 public boolean isRelevant(String docName, QualityQuery query);
35 * Validate that queries and this Judge match each other.
36 * To be perfectly valid, this Judge must have some data for each and every
37 * input quality query, and must not have any data on any other quality query.
38 * <b>Note</b>: the quality benchmark run would not fail in case of imperfect
39 * validity, just a warning message would be logged.
40 * @param qq quality queries to be validated.
41 * @param logger if not null, validation issues are logged.
42 * @return true if perfectly valid, false if not.
44 public boolean validateData (QualityQuery qq[], PrintWriter logger);
47 * Return the maximal recall for the input quality query.
48 * It is the number of relevant docs this Judge "knows" for the query.
49 * @param query the query whose maximal recall is needed.
51 public int maxRecall (QualityQuery query);