## org.apache.lucene.search.spans
Interface PayloadSpans

All Superinterfaces:
  Spans

All Known Implementing Classes:
  TermSpans

    public interface PayloadSpans

extends Spans

WARNING: The status of the Payloads feature is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.

Method Summary
`Collection` `getPayload()` Returns the payload data for the current span.
`boolean` `isPayloadAvailable()` Checks if a payload can be loaded at this position.

Methods inherited from interface org.apache.lucene.search.spans.Spans
`doc, end, next, skipTo, start`

Method Detail

### getPayload

    Collection getPayload()
                          throws IOException

  Returns the payload data for the current span. This is invalid until `Spans.next()` is called for the first time. This method must not be called more than once after each call of `Spans.next()`. However, payloads are loaded lazily, so if the payload data for the current position is not needed, this method may not be called at all for performance reasons.
  Note that the return type is a collection, thus the ordering should not be relied upon.

  WARNING: The status of the Payloads feature is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.

  Returns:
    a List of byte arrays containing the data of this payload, otherwise null if isPayloadAvailable is false
  Throws:
    `IOException`

### isPayloadAvailable

    boolean isPayloadAvailable()

  Checks if a payload can be loaded at this position.

  Payloads can only be loaded once per call to `Spans.next()`.

  WARNING: The status of the Payloads feature is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.

  Returns:
    true if there is a payload available at this position that can be loaded

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