01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
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.
16: */package org.apache.lucene.benchmark.quality;
17:
18: import java.io.PrintWriter;
19:
20: /**
21: * Judge if a document is relevant for a quality query.
22: */
23: public interface Judge {
24:
25: /**
26: * Judge if document <code>docName</code> is relevant for the given quality query.
27: * @param docName name of doc tested for relevancy.
28: * @param query tested quality query.
29: * @return true if relevant, false if not.
30: */
31: public boolean isRelevant(String docName, QualityQuery query);
32:
33: /**
34: * Validate that queries and this Judge match each other.
35: * To be perfectly valid, this Judge must have some data for each and every
36: * input quality query, and must not have any data on any other quality query.
37: * <b>Note</b>: the quality benchmark run would not fail in case of imperfect
38: * validity, just a warning message would be logged.
39: * @param qq quality queries to be validated.
40: * @param logger if not null, validation issues are logged.
41: * @return true if perfectly valid, false if not.
42: */
43: public boolean validateData(QualityQuery qq[], PrintWriter logger);
44:
45: /**
46: * Return the maximal recall for the input quality query.
47: * It is the number of relevant docs this Judge "knows" for the query.
48: * @param query the query whose maximal recall is needed.
49: */
50: public int maxRecall(QualityQuery query);
51:
52: }
|