-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQrySop.java
49 lines (44 loc) · 1.83 KB
/
QrySop.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Copyright (c) 2017, Carnegie Mellon University. All Rights Reserved.
*/
import java.io.*;
/**
* The root class of all query operators that use a retrieval model
* to determine whether a query matches a document and to calculate a
* score for the document. This class has two main purposes. First, it
* allows query operators to easily recognize any nested query
* operator that returns a document scores (e.g., #AND (a #OR(b c)).
* Second, it is a place to store data structures and methods that are
* common to all query operators that calculate document scores.
*/
public abstract class QrySop extends Qry {
/**
* Get a score for the document that docIteratorHasMatch matched.
* @param r The retrieval model that determines how scores are calculated.
* @return The document score.
* @throws IOException Error accessing the Lucene index
*/
public abstract double getScore (RetrievalModel r)
throws IOException;
/**
* Get a score for the document that docIteratorHasMatch matched.
* @param r The retrieval model that determines how scores are calculated.
* @return The document score.
* @throws IOException Error accessing the Lucene index
*/
public abstract double getDefaultScore (RetrievalModel r, int doc_id)
throws IOException;
/**
* Initialize the query operator (and its arguments), including any
* internal iterators. If the query operator is of type QryIop, it
* is fully evaluated, and the results are stored in an internal
* inverted list that may be accessed via the internal iterator.
* @param r A retrieval model that guides initialization
* @throws IOException Error accessing the Lucene index.
*/
public void initialize(RetrievalModel r) throws IOException {
for (Qry q_i: this.args) {
q_i.initialize (r);
}
}
}