pitt.search.semanticvectors
Class VectorStoreReaderLucene

java.lang.Object
  extended by pitt.search.semanticvectors.VectorStoreReaderLucene
All Implemented Interfaces:
CloseableVectorStore, VectorStore

public class VectorStoreReaderLucene
extends java.lang.Object
implements CloseableVectorStore

This class provides methods for reading a VectorStore from disk.

The serialization currently presumes that the object (in the ObjectVectors) should be serialized as a String.

The implementation uses Lucene's I/O package, which proved much faster than the native java.io.DataOutputStream

See Also:
ObjectVector

Nested Class Summary
 class VectorStoreReaderLucene.VectorEnumeration
          Implements the hasMoreElements() and nextElement() methods to give Enumeration interface from store on disk.
 
Constructor Summary
VectorStoreReaderLucene(java.lang.String vectorFileName)
           
 
Method Summary
 void close()
          Release all filesystem or other resources that aren't automatically garbage collected.
 org.apache.lucene.store.FSDirectory fsDirectory()
           
 java.util.Enumeration getAllVectors()
           
 int getNumVectors()
          Trivial (costly) implementation of getNumVectors that iterates and counts vectors.
 float[] getVector(java.lang.Object desiredObject)
          Given an object, get its corresponding vector
This implementation only works for string objects so far
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorStoreReaderLucene

public VectorStoreReaderLucene(java.lang.String vectorFileName)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

fsDirectory

public org.apache.lucene.store.FSDirectory fsDirectory()

close

public void close()
Description copied from interface: CloseableVectorStore
Release all filesystem or other resources that aren't automatically garbage collected.

Specified by:
close in interface CloseableVectorStore

getAllVectors

public java.util.Enumeration getAllVectors()
Specified by:
getAllVectors in interface VectorStore
Returns:
an enumeration of all the object vectors in the store.

getVector

public float[] getVector(java.lang.Object desiredObject)
Given an object, get its corresponding vector
This implementation only works for string objects so far

Specified by:
getVector in interface VectorStore
Parameters:
desiredObject - - the string you're searching for
Returns:
vector from the VectorStore, or null if not found.

getNumVectors

public int getNumVectors()
Trivial (costly) implementation of getNumVectors that iterates and counts vectors.

Specified by:
getNumVectors in interface VectorStore
Returns:
a count of the number of vectors in the store.