Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

public interface Spans

Expert: an enumeration of span matches. Used to implement span searching. Each span represents a range of term positions within a document. Matches are enumerated in order, by increasing document number, within that by increasing start position and finally by increasing end position.

Method Summary
`int` | `doc()` Returns the document number of the current match.
`int` | `end()` Returns the end position of the current match.
`boolean` | `next()` Move to the next match, returning true iff any such exists.
`boolean` | `skipTo(int target)` Skips to the first match beyond the current, whose document number is greater than or equal to target.
`int` | `start()` Returns the start position of the current match.

Method Detail

### next

    public boolean next()
                 throws IOException

  Move to the next match, returning true iff any such exists.

  Throws:
    `IOException`

### skipTo

    public boolean skipTo(int target)
                   throws IOException

  Skips to the first match beyond the current, whose document number is greater than or equal to target.

  Returns true iff there is such a match.

  Behaves as if written:

         boolean skipTo(int target) {
           do {
             if (!next())
       	     return false;
           } while (target > doc());
           return true;
         }

  Most implementations are considerably more efficient than that.

  Throws:
    `IOException`

### doc

    public int doc()

  Returns the document number of the current match. Initially invalid.

### start

    public int start()

  Returns the start position of the current match. Initially invalid.

### end

    public int end()

  Returns the end position of the current match. Initially invalid.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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