Package org.apache.lucene.codecs

# Class StoredFieldsWriter.MergeVisitor

java.lang.Object
org.apache.lucene.index.StoredFieldVisitor
org.apache.lucene.codecs.StoredFieldsWriter.MergeVisitor

Enclosing class:
  `StoredFieldsWriter`

protected class StoredFieldsWriter.MergeVisitor extends StoredFieldVisitor
A visitor that adds every field it sees.

Use like this:

     MergeVisitor visitor = new MergeVisitor(mergeState, readerIndex);
     for (...) {
       startDocument();
       storedFieldsReader.document(docID, visitor);
       finishDocument();
     }

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.lucene.index.StoredFieldVisitor

`StoredFieldVisitor.Status`

## Constructor Summary

Constructors
Constructor
Description
`MergeVisitor(MergeState mergeState, int readerIndex)`
Create new merge visitor.

## Method Summary

Modifier and Type
Method
Description
`void`
`binaryField(FieldInfo fieldInfo, byte[] value)`
Process a binary field.
`void`
`binaryField(FieldInfo fieldInfo, DataInput value, int length)`
Expert: Process a binary field directly from the `DataInput`.
`void`
`doubleField(FieldInfo fieldInfo, double value)`
Process a double numeric field.
`void`
`floatField(FieldInfo fieldInfo, float value)`
Process a float numeric field.
`void`
`intField(FieldInfo fieldInfo, int value)`
Process a int numeric field.
`void`
`longField(FieldInfo fieldInfo, long value)`
Process a long numeric field.
`StoredFieldVisitor.Status`
`needsField(FieldInfo fieldInfo)`
Hook before processing a field.
`void`
`stringField(FieldInfo fieldInfo, String value)`
Process a string field.

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

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

## Constructor Details

### MergeVisitor

public MergeVisitor(MergeState mergeState, int readerIndex)
Create new merge visitor.

## Method Details

### binaryField

public void binaryField(FieldInfo fieldInfo, DataInput value, int length) throws IOException
Description copied from class: `StoredFieldVisitor`
Expert: Process a binary field directly from the `DataInput`. Implementors of this method must read `length` bytes from the given `DataInput`. The default implementation reads all byes in a newly created byte array and calls `StoredFieldVisitor.binaryField(FieldInfo, byte[])`.

Overrides:
  `binaryField` in class `StoredFieldVisitor`
Parameters:
  `value` - newly allocated byte array with the binary contents.
Throws:
  `IOException`

### binaryField

public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException
Description copied from class: `StoredFieldVisitor`
Process a binary field.

Overrides:
  `binaryField` in class `StoredFieldVisitor`
Parameters:
  `value` - newly allocated byte array with the binary contents.
Throws:
  `IOException`

### stringField

public void stringField(FieldInfo fieldInfo, String value) throws IOException
Description copied from class: `StoredFieldVisitor`
Process a string field.

Overrides:
  `stringField` in class `StoredFieldVisitor`
Throws:
  `IOException`

### intField

public void intField(FieldInfo fieldInfo, int value) throws IOException
Description copied from class: `StoredFieldVisitor`
Process a int numeric field.

Overrides:
  `intField` in class `StoredFieldVisitor`
Throws:
  `IOException`

### longField

public void longField(FieldInfo fieldInfo, long value) throws IOException
Description copied from class: `StoredFieldVisitor`
Process a long numeric field.

Overrides:
  `longField` in class `StoredFieldVisitor`
Throws:
  `IOException`

### floatField

public void floatField(FieldInfo fieldInfo, float value) throws IOException
Description copied from class: `StoredFieldVisitor`
Process a float numeric field.

Overrides:
  `floatField` in class `StoredFieldVisitor`
Throws:
  `IOException`

### doubleField

public void doubleField(FieldInfo fieldInfo, double value) throws IOException
Description copied from class: `StoredFieldVisitor`
Process a double numeric field.

Overrides:
  `doubleField` in class `StoredFieldVisitor`
Throws:
  `IOException`

### needsField

public StoredFieldVisitor.Status needsField(FieldInfo fieldInfo) throws IOException
Description copied from class: `StoredFieldVisitor`
Hook before processing a field. Before a field is processed, this method is invoked so that subclasses can return a `StoredFieldVisitor.Status` representing whether they need that particular field or not, or to stop processing entirely.

Specified by:
  `needsField` in class `StoredFieldVisitor`
Throws:
  `IOException`