org.apache.lucene.index

## Class MultipleTermPositions

- java.lang.Object
- - org.apache.lucene.index.MultipleTermPositions

- All Implemented Interfaces:
    TermDocs, TermPositions

      public class MultipleTermPositions
      extends java.lang.Object
      implements TermPositions

  Allows you to iterate over the `TermPositions` for multiple `Term`s as a single `TermPositions`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultipleTermPositions(IndexReader indexReader, Term[] terms)` Creates a new `MultipleTermPositions` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Frees associated resources.
    `int` | `doc()` Returns the current document number.
    `int` | `freq()` Returns the frequency of the term within the current document.
    `byte[]` | `getPayload(byte[] data, int offset)` Not implemented.
    `int` | `getPayloadLength()` Not implemented.
    `boolean` | `isPayloadAvailable()` Checks if a payload can be loaded at this position.
    `boolean` | `next()` Moves to the next pair in the enumeration.
    `int` | `nextPosition()` Returns next position in the current document.
    `int` | `read(int[] arg0, int[] arg1)` Not implemented.
    `void` | `seek(Term arg0)` Not implemented.
    `void` | `seek(TermEnum termEnum)` Not implemented.
    `boolean` | `skipTo(int target)` Skips entries to the first beyond the current whose document number is greater than or equal to target.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MultipleTermPositions

          public MultipleTermPositions(IndexReader indexReader,
                                       Term[] terms)
                                throws java.io.IOException

      Creates a new `MultipleTermPositions` instance.
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### next

          public final boolean next()
                             throws java.io.IOException

      Description copied from interface: `TermDocs`
      Moves to the next pair in the enumeration.

      Returns true iff there is such a next pair in the enumeration.

      Specified by:
        `next` in interface `TermDocs`
      Throws:
        `java.io.IOException`

    - #### nextPosition

          public final int nextPosition()

      Description copied from interface: `TermPositions`
      Returns next position in the current document. It is an error to call this more than `TermDocs.freq()` times without calling `TermDocs.next()`

      This is invalid until `TermDocs.next()` is called for the first time.

      Specified by:
        `nextPosition` in interface `TermPositions`

    - #### skipTo

          public final boolean skipTo(int target)
                               throws java.io.IOException

      Description copied from interface: `TermDocs`
      Skips entries to the first beyond the current whose document number is greater than or equal to target.

      Returns true iff there is such an entry.

      Behaves as if written:

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

      Some implementations are considerably more efficient than that.
      Specified by:
        `skipTo` in interface `TermDocs`
      Throws:
        `java.io.IOException`

    - #### doc

          public final int doc()

      Description copied from interface: `TermDocs`
      Returns the current document number.

      This is invalid until `TermDocs.next()` is called for the first time.

      Specified by:
        `doc` in interface `TermDocs`

    - #### freq

          public final int freq()

      Description copied from interface: `TermDocs`
      Returns the frequency of the term within the current document.

      This is invalid until `TermDocs.next()` is called for the first time.

      Specified by:
        `freq` in interface `TermDocs`

    - #### close

          public final void close()
                           throws java.io.IOException

      Description copied from interface: `TermDocs`
      Frees associated resources.
      Specified by:
        `close` in interface `TermDocs`
      Throws:
        `java.io.IOException`

    - #### seek

          public void seek(Term arg0)
                    throws java.io.IOException

      Not implemented.
      Specified by:
        `seek` in interface `TermDocs`
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.io.IOException`

    - #### seek

          public void seek(TermEnum termEnum)
                    throws java.io.IOException

      Not implemented.
      Specified by:
        `seek` in interface `TermDocs`
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.io.IOException`

    - #### read

          public int read(int[] arg0,
                          int[] arg1)
                   throws java.io.IOException

      Not implemented.
      Specified by:
        `read` in interface `TermDocs`
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.io.IOException`

    - #### getPayloadLength

          public int getPayloadLength()

      Not implemented.
      Specified by:
        `getPayloadLength` in interface `TermPositions`
      Returns:
        length of the current payload in number of bytes
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### getPayload

          public byte[] getPayload(byte[] data,
                                   int offset)
                            throws java.io.IOException

      Not implemented.
      Specified by:
        `getPayload` in interface `TermPositions`
      Parameters:
        `data` - the array into which the data of this payload is to be stored, if it is big enough; otherwise, a new byte[] array is allocated for this purpose.
        `offset` - the offset in the array into which the data of this payload is to be stored.
      Returns:
        a byte[] array containing the data of this payload
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.io.IOException`

    - #### isPayloadAvailable

          public boolean isPayloadAvailable()

      Description copied from interface: `TermPositions`
      Checks if a payload can be loaded at this position.

      Payloads can only be loaded once per call to `TermPositions.nextPosition()`.

      Specified by:
        `isPayloadAvailable` in interface `TermPositions`
      Returns:
        false

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