org.apache.lucene.luke.models.documents

## Class DocumentsImpl

- java.lang.Object
- - org.apache.lucene.luke.models.LukeModel
  - - org.apache.lucene.luke.models.documents.DocumentsImpl

All Implemented Interfaces:
  Documents

    public final class DocumentsImpl
    extends LukeModel
    implements Documents

Default implementation of `Documents`

### Field Summary

### Fields inherited from class org.apache.lucene.luke.models.LukeModel

`commit, dir, liveDocs, reader`

### Constructor Summary

Constructors
Constructor and Description
`DocumentsImpl(IndexReader reader)` Constructs an DocumentsImpl that holds given `IndexReader`.

### Method Summary

All Methods Instance Methods Concrete Methods
`Optional<Term>` `firstTerm(String field)` Returns the first indexed term in the specified field.
`Optional<Integer>` `firstTermDoc()` Returns the first document id (posting) associated with the current term.
`String` `getCurrentField()` Returns the current target field name.
`Optional<Integer>` `getDocFreq()` Returns the document frequency for the current term (the number of documents containing the current term.) Empty Optional instance is returned if the terms iterator has not been positioned yet.
`List<DocumentField>` `getDocumentFields(int docid)` Returns the list of field information and field data for the specified document.
`Optional<DocValues>` `getDocValues(int docid, String field)` Returns the doc values for the specified field in the specified document.
`int` `getMaxDoc()` Returns one greater than the largest possible document number.
`List<TermPosting>` `getTermPositions()` Returns the list of the position information for the current posting.
`List<TermVectorEntry>` `getTermVectors(int docid, String field)` Returns the term vectors for the specified field in the specified document.
`boolean` `isLive(int docid)` Returns true if the document with the specified `docid` is not deleted, otherwise false.
`Optional<Term>` `nextTerm()` Increments the terms iterator and returns the next indexed term for the target field.
`Optional<Integer>` `nextTermDoc()` Increments the postings iterator and returns the next document id (posting) for the current term.
`Optional<Term>` `seekTerm(String termText)` Seeks to the specified term, if it exists, or to the next (ceiling) term.

### Methods inherited from class org.apache.lucene.luke.models.LukeModel

`getFieldNames`

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

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

### Methods inherited from interface org.apache.lucene.luke.models.documents.Documents

`getFieldNames`

### Constructor Detail

#### DocumentsImpl

    public DocumentsImpl(IndexReader reader)

Constructs an DocumentsImpl that holds given `IndexReader`.

Parameters:
  `reader` - - the index reader

### Method Detail

#### getMaxDoc

    public int getMaxDoc()

Description copied from interface: `Documents`
Returns one greater than the largest possible document number.

Specified by:
  `getMaxDoc` in interface `Documents`

#### isLive

    public boolean isLive(int docid)

Description copied from interface: `Documents`
Returns true if the document with the specified `docid` is not deleted, otherwise false.

Specified by:
  `isLive` in interface `Documents`
Parameters:
  `docid` - - document id

#### getDocumentFields

    public List<DocumentField> getDocumentFields(int docid)

Description copied from interface: `Documents`
Returns the list of field information and field data for the specified document.

Specified by:
  `getDocumentFields` in interface `Documents`
Parameters:
  `docid` - - document id

#### getCurrentField

    public String getCurrentField()

Description copied from interface: `Documents`
Returns the current target field name.

Specified by:
  `getCurrentField` in interface `Documents`

#### firstTerm

    public Optional<Term> firstTerm(String field)

Description copied from interface: `Documents`
Returns the first indexed term in the specified field. Empty Optional instance is returned if no terms are available for the field.

Specified by:
  `firstTerm` in interface `Documents`
Parameters:
  `field` - - field name

#### nextTerm

    public Optional<Term> nextTerm()

Description copied from interface: `Documents`
Increments the terms iterator and returns the next indexed term for the target field. Empty Optional instance is returned if the terms iterator has not been positioned yet, or has been exhausted.

Specified by:
  `nextTerm` in interface `Documents`
Returns:
  next term, if exists, or empty

#### seekTerm

    public Optional<Term> seekTerm(String termText)

Description copied from interface: `Documents`
Seeks to the specified term, if it exists, or to the next (ceiling) term. Returns the term that was found. Empty Optional instance is returned if the terms iterator has not been positioned yet, or has been exhausted.

Specified by:
  `seekTerm` in interface `Documents`
Parameters:
  `termText` - - term to seek
Returns:
  found term, if exists, or empty

#### firstTermDoc

    public Optional<Integer> firstTermDoc()

Description copied from interface: `Documents`
Returns the first document id (posting) associated with the current term. Empty Optional instance is returned if the terms iterator has not been positioned yet, or the postings iterator has been exhausted.

Specified by:
  `firstTermDoc` in interface `Documents`
Returns:
  document id, if exists, or empty

#### nextTermDoc

    public Optional<Integer> nextTermDoc()

Description copied from interface: `Documents`
Increments the postings iterator and returns the next document id (posting) for the current term. Empty Optional instance is returned if the terms iterator has not been positioned yet, or the postings iterator has been exhausted.

Specified by:
  `nextTermDoc` in interface `Documents`
Returns:
  document id, if exists, or empty

#### getTermPositions

    public List<TermPosting> getTermPositions()

Description copied from interface: `Documents`
Returns the list of the position information for the current posting.

Specified by:
  `getTermPositions` in interface `Documents`

#### getDocFreq

    public Optional<Integer> getDocFreq()

Description copied from interface: `Documents`
Returns the document frequency for the current term (the number of documents containing the current term.) Empty Optional instance is returned if the terms iterator has not been positioned yet.

Specified by:
  `getDocFreq` in interface `Documents`

#### getTermVectors

    public List<TermVectorEntry> getTermVectors(int docid,
                                                String field)

Description copied from interface: `Documents`
Returns the term vectors for the specified field in the specified document. If no term vector is available for the field, empty list is returned.

Specified by:
  `getTermVectors` in interface `Documents`
Parameters:
  `docid` - - document id
  `field` - - field name
Returns:
  list of term vector elements

#### getDocValues

    public Optional<DocValues> getDocValues(int docid,
                                            String field)

Description copied from interface: `Documents`
Returns the doc values for the specified field in the specified document. Empty Optional instance is returned if no doc values is available for the field.

Specified by:
  `getDocValues` in interface `Documents`
Parameters:
  `docid` - - document id
  `field` - - field name
Returns:
  doc values, if exists, or empty