org.apache.lucene.search

## Class Hit

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

- All Implemented Interfaces:
    java.io.Serializable

  Deprecated.
  Use `TopScoreDocCollector` and `TopDocs` instead. Hits will be removed in Lucene 3.0.

      public class Hit
      extends java.lang.Object
      implements java.io.Serializable

  Wrapper used by `HitIterator` to provide a lazily loaded hit from `Hits`.
  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `get(java.lang.String name)` Deprecated. Returns the string value of the field with the given name if any exist in this document, or null.
    `float` | `getBoost()` Deprecated. Returns the boost factor for this hit on any field of the underlying document.
    `Document` | `getDocument()` Deprecated. Returns document for this hit.
    `int` | `getId()` Deprecated. Returns id for this hit.
    `float` | `getScore()` Deprecated. Returns score for this hit.
    `java.lang.String` | `toString()` Deprecated. 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,
                                      java.io.IOException

      Deprecated.
      Returns document for this hit.
      Throws:
        `CorruptIndexException` - if the index is corrupt
        `java.io.IOException` - if there is a low-level IO error
      See Also:
        `Hits.doc(int)`

    - #### getScore

          public float getScore()
                         throws java.io.IOException

      Deprecated.
      Returns score for this hit.
      Throws:
        `java.io.IOException`
      See Also:
        `Hits.score(int)`

    - #### getId

          public int getId()
                    throws java.io.IOException

      Deprecated.
      Returns id for this hit.
      Throws:
        `java.io.IOException`
      See Also:
        `Hits.id(int)`

    - #### getBoost

          public float getBoost()
                         throws CorruptIndexException,
                                java.io.IOException

      Deprecated.
      Returns the boost factor for this hit on any field of the underlying document.
      Throws:
        `CorruptIndexException` - if the index is corrupt
        `java.io.IOException` - if there is a low-level IO error
      See Also:
        `Document.getBoost()`

    - #### get

          public java.lang.String get(java.lang.String name)
                               throws CorruptIndexException,
                                      java.io.IOException

      Deprecated.
      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
        `java.io.IOException` - if there is a low-level IO error
      See Also:
        `Document.get(String)`

    - #### toString

          public java.lang.String toString()

      Deprecated.
      Prints the parameters to be used to discover the promised result.
      Overrides:
        `toString` in class `java.lang.Object`

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