1 package org.apache.lucene.search;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 /** Holds one hit in {@link TopDocs}. */
22 public class ScoreDoc implements java.io.Serializable {
24 /** The score of this document for the query. */
27 /** Expert: A hit document's number.
28 * @see Searcher#doc(int) */
31 /** Only set by {@link TopDocs#merge} */
32 public int shardIndex;
34 /** Constructs a ScoreDoc. */
35 public ScoreDoc(int doc, float score) {
39 /** Constructs a ScoreDoc. */
40 public ScoreDoc(int doc, float score, int shardIndex) {
43 this.shardIndex = shardIndex;
46 // A convenience method for debugging.
48 public String toString() {
49 return "doc=" + doc + " score=" + score;