## org.apache.lucene.search
Class Hit

    java.lang.Object
      org.apache.lucene.search.Hit

All Implemented Interfaces:
  Serializable

    public class Hit

extends Object
implements Serializable

Wrapper used by `HitIterator` to provide a lazily loaded hit from `Hits`.

Author:
  Jeremy Rayner
See Also:
  Serialized Form

Method Summary
`String` `get(String name)` Returns the string value of the field with the given name if any exist in this document, or null.
`float` `getBoost()` Returns the boost factor for this hit on any field of the underlying document.
`Document` `getDocument()` Returns document for this hit.
`int` `getId()` Returns id for this hit.
`float` `getScore()` Returns score for this hit.
`String` `toString()` Prints the parameters to be used to discover the promised result.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### getDocument

    public Document getDocument()
                         throws CorruptIndexException,
                                IOException

  Returns document for this hit.

  Throws:
    `CorruptIndexException` - if the index is corrupt
    `IOException` - if there is a low-level IO error
  See Also:
    `Hits.doc(int)`

### getScore

    public float getScore()
                   throws IOException

  Returns score for this hit.

  Throws:
    `IOException`
  See Also:
    `Hits.score(int)`

### getId

    public int getId()
              throws IOException

  Returns id for this hit.

  Throws:
    `IOException`
  See Also:
    `Hits.id(int)`

### getBoost

    public float getBoost()
                   throws CorruptIndexException,
                          IOException

  Returns the boost factor for this hit on any field of the underlying document.

  Throws:
    `CorruptIndexException` - if the index is corrupt
    `IOException` - if there is a low-level IO error
  See Also:
    `Document.getBoost()`

### get

    public String get(String name)
               throws CorruptIndexException,
                      IOException

  Returns the string value of the field with the given name if any exist in this document, or null. If multiple fields exist with this name, this method returns the first value added. If only binary fields with this name exist, returns null.

  Throws:
    `CorruptIndexException` - if the index is corrupt
    `IOException` - if there is a low-level IO error
  See Also:
    `Document.get(String)`

### toString

    public String toString()

  Prints the parameters to be used to discover the promised result.

  Overrides:
    `toString` in class `Object`

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.