pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / src / java / org / apache / lucene / search / ScoreDoc.java
1 package org.apache.lucene.search;
2
3 /**
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
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 /** Holds one hit in {@link TopDocs}. */
21
22 public class ScoreDoc implements java.io.Serializable {
23
24   /** The score of this document for the query. */
25   public float score;
26
27   /** Expert: A hit document's number.
28    * @see Searcher#doc(int) */
29   public int doc;
30
31   /** Only set by {@link TopDocs#merge} */
32   public int shardIndex;
33
34   /** Constructs a ScoreDoc. */
35   public ScoreDoc(int doc, float score) {
36     this(doc, score, -1);
37   }
38
39   /** Constructs a ScoreDoc. */
40   public ScoreDoc(int doc, float score, int shardIndex) {
41     this.doc = doc;
42     this.score = score;
43     this.shardIndex = shardIndex;
44   }
45   
46   // A convenience method for debugging.
47   @Override
48   public String toString() {
49     return "doc=" + doc + " score=" + score;
50   }
51 }