gate.creole.annic.apache.lucene.index
Class FieldInfos

java.lang.Object
  extended by gate.creole.annic.apache.lucene.index.FieldInfos

final class FieldInfos
extends Object

Access to the Field Info file that describes document fields and whether or not they are indexed. Each segment has a separate Field Info file. Objects of this class are thread-safe for multiple readers, but only one thread can be adding documents at a time, with no other reader or writer threads accessing this object.


Field Summary
private  Hashtable byName
           
private  Vector byNumber
           
 
Constructor Summary
FieldInfos()
           
FieldInfos(Directory d, String name)
          Construct a FieldInfos object using the directory and the name of the file InputStream
 
Method Summary
 void add(Collection names, boolean isIndexed)
          Assumes the field is not storing term vectors
 void add(Document doc)
          Adds field info for a Document.
 void add(String name, boolean isIndexed)
          Calls three parameter add with false for the storeTermVector parameter
 void add(String name, boolean isIndexed, boolean storeTermVector)
          If the field is not yet known, adds it.
 void addIndexed(Collection names, boolean storeTermVectors)
           
private  void addInternal(String name, boolean isIndexed, boolean storeTermVector)
           
 FieldInfo fieldInfo(int fieldNumber)
           
 FieldInfo fieldInfo(String fieldName)
           
 String fieldName(int fieldNumber)
           
 int fieldNumber(String fieldName)
           
 boolean hasVectors()
           
private  void read(InputStream input)
           
 int size()
           
 void write(Directory d, String name)
           
 void write(OutputStream output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

byNumber

private Vector byNumber

byName

private Hashtable byName
Constructor Detail

FieldInfos

FieldInfos()

FieldInfos

FieldInfos(Directory d,
           String name)
     throws IOException
Construct a FieldInfos object using the directory and the name of the file InputStream

Parameters:
d - The directory to open the InputStream from
name - The name of the file to open the InputStream from in the Directory
Throws:
IOException
See Also:
read(gate.creole.annic.apache.lucene.store.InputStream)
Method Detail

add

public void add(Document doc)
Adds field info for a Document.


addIndexed

public void addIndexed(Collection names,
                       boolean storeTermVectors)
Parameters:
names - The names of the fields
storeTermVectors - Whether the fields store term vectors or not

add

public void add(Collection names,
                boolean isIndexed)
Assumes the field is not storing term vectors

Parameters:
names - The names of the fields
isIndexed - Whether the fields are indexed or not
See Also:
add(String, boolean)

add

public void add(String name,
                boolean isIndexed)
Calls three parameter add with false for the storeTermVector parameter

Parameters:
name - The name of the Field
isIndexed - true if the field is indexed
See Also:
add(String, boolean, boolean)

add

public void add(String name,
                boolean isIndexed,
                boolean storeTermVector)
If the field is not yet known, adds it. If it is known, checks to make sure that the isIndexed flag is the same as was given previously for this field. If not - marks it as being indexed. Same goes for storeTermVector

Parameters:
name - The name of the field
isIndexed - true if the field is indexed
storeTermVector - true if the term vector should be stored

addInternal

private void addInternal(String name,
                         boolean isIndexed,
                         boolean storeTermVector)

fieldNumber

public int fieldNumber(String fieldName)

fieldInfo

public FieldInfo fieldInfo(String fieldName)

fieldName

public String fieldName(int fieldNumber)

fieldInfo

public FieldInfo fieldInfo(int fieldNumber)

size

public int size()

hasVectors

public boolean hasVectors()

write

public void write(Directory d,
                  String name)
           throws IOException
Throws:
IOException

write

public void write(OutputStream output)
           throws IOException
Throws:
IOException

read

private void read(InputStream input)
           throws IOException
Throws:
IOException