org.apache.lucene.index
Class DocValues.Source

java.lang.Object
  extended by org.apache.lucene.index.DocValues.Source
Direct Known Subclasses:
DocValues.SortedSource, DocValuesArraySource
Enclosing class:
DocValues

public abstract static class DocValues.Source
extends Object

Source of per document values like long, double or BytesRef depending on the DocValues fields DocValues.Type. Source implementations provide random access semantics similar to array lookups

See Also:
DocValues.getSource(), DocValues.getDirectSource()

Field Summary
protected  DocValues.Type type
          DocValues.Type of this Source.
 
Constructor Summary
protected DocValues.Source(DocValues.Type type)
          Sole constructor.
 
Method Summary
 DocValues.SortedSource asSortedSource()
          If this DocValues.Source is sorted this method will return an instance of DocValues.SortedSource otherwise UOE
 Object getArray()
          Returns the internal array representation iff this DocValues.Source uses an array as its inner representation, otherwise UOE.
 BytesRef getBytes(int docID, BytesRef ref)
          Returns a BytesRef for the given document id or throws an UnsupportedOperationException if this source doesn't support byte[] values.
 double getFloat(int docID)
          Returns a double for the given document id or throws an UnsupportedOperationException if this source doesn't support double values.
 long getInt(int docID)
          Returns a long for the given document id or throws an UnsupportedOperationException if this source doesn't support long values.
 DocValues.Type getType()
          Returns the DocValues.Type of this source.
 boolean hasArray()
          Returns true iff this DocValues.Source exposes an array via getArray() otherwise false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected final DocValues.Type type
DocValues.Type of this Source.

Constructor Detail

DocValues.Source

protected DocValues.Source(DocValues.Type type)
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

getInt

public long getInt(int docID)
Returns a long for the given document id or throws an UnsupportedOperationException if this source doesn't support long values.

Throws:
UnsupportedOperationException - if this source doesn't support long values.

getFloat

public double getFloat(int docID)
Returns a double for the given document id or throws an UnsupportedOperationException if this source doesn't support double values.

Throws:
UnsupportedOperationException - if this source doesn't support double values.

getBytes

public BytesRef getBytes(int docID,
                         BytesRef ref)
Returns a BytesRef for the given document id or throws an UnsupportedOperationException if this source doesn't support byte[] values.

Throws:
UnsupportedOperationException - if this source doesn't support byte[] values.

getType

public DocValues.Type getType()
Returns the DocValues.Type of this source.

Returns:
the DocValues.Type of this source.

hasArray

public boolean hasArray()
Returns true iff this DocValues.Source exposes an array via getArray() otherwise false.

Returns:
true iff this DocValues.Source exposes an array via getArray() otherwise false.

getArray

public Object getArray()
Returns the internal array representation iff this DocValues.Source uses an array as its inner representation, otherwise UOE.


asSortedSource

public DocValues.SortedSource asSortedSource()
If this DocValues.Source is sorted this method will return an instance of DocValues.SortedSource otherwise UOE



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