org.apache.lucene.codecs
Class PerDocProducerBase

java.lang.Object
  extended by org.apache.lucene.codecs.PerDocProducer
      extended by org.apache.lucene.codecs.PerDocProducerBase
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
Lucene40DocValuesProducer, SepDocValuesProducer, SimpleTextPerDocProducer

public abstract class PerDocProducerBase
extends PerDocProducer

Abstract base class for PerDocProducer implementations

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
PerDocProducerBase()
           
 
Method Summary
protected  boolean anyDocValuesFields(FieldInfos infos)
           
protected  boolean canLoad(FieldInfo info)
           
 void close()
           
protected abstract  void closeInternal(Collection<? extends Closeable> closeables)
           
protected abstract  Map<String,DocValues> docValues()
           
 DocValues docValues(String field)
          Returns DocValues for the current field.
static String docValuesId(String segmentsName, int fieldId)
           
 Comparator<BytesRef> getComparator()
           
protected  DocValues.Type getDocValuesType(FieldInfo info)
           
protected  TreeMap<String,DocValues> load(FieldInfos fieldInfos, String segment, int docCount, Directory dir, IOContext context)
           
protected abstract  DocValues loadDocValues(int docCount, Directory dir, String id, DocValues.Type type, IOContext context)
          Loads a DocValues instance depending on the given DocValues.Type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerDocProducerBase

public PerDocProducerBase()
Method Detail

closeInternal

protected abstract void closeInternal(Collection<? extends Closeable> closeables)
                               throws IOException
Throws:
IOException

docValues

protected abstract Map<String,DocValues> docValues()

close

public void close()
           throws IOException
Throws:
IOException

docValues

public DocValues docValues(String field)
                    throws IOException
Description copied from class: PerDocProducer
Returns DocValues for the current field.

Specified by:
docValues in class PerDocProducer
Parameters:
field - the field name
Returns:
the DocValues for this field or null if not applicable.
Throws:
IOException

getComparator

public Comparator<BytesRef> getComparator()
                                   throws IOException
Throws:
IOException

load

protected TreeMap<String,DocValues> load(FieldInfos fieldInfos,
                                         String segment,
                                         int docCount,
                                         Directory dir,
                                         IOContext context)
                                  throws IOException
Throws:
IOException

canLoad

protected boolean canLoad(FieldInfo info)

getDocValuesType

protected DocValues.Type getDocValuesType(FieldInfo info)

anyDocValuesFields

protected boolean anyDocValuesFields(FieldInfos infos)

docValuesId

public static String docValuesId(String segmentsName,
                                 int fieldId)

loadDocValues

protected abstract DocValues loadDocValues(int docCount,
                                           Directory dir,
                                           String id,
                                           DocValues.Type type,
                                           IOContext context)
                                    throws IOException
Loads a DocValues instance depending on the given DocValues.Type. Codecs that use different implementations for a certain DocValues.Type can simply override this method and return their custom implementations.

Parameters:
docCount - number of documents in the segment
dir - the Directory to load the DocValues from
id - the unique file ID within the segment
type - the type to load
Returns:
a DocValues instance for the given type
Throws:
IOException - if an IOException occurs
IllegalArgumentException - if the given DocValues.Type is not supported


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