FileDocCategorySizeDatePackage
FieldCache.javaAPI DocApache Lucene 2.1.07485Wed Feb 14 10:46:38 GMT 2007org.apache.lucene.search

FieldCache

public interface FieldCache
Expert: Maintains caches of term values.

Created: May 19, 2004 11:13:14 AM

author
Tim Jones (Nacimiento Software)
since
lucene 1.4
version
$Id: FieldCache.java 472959 2006-11-09 16:21:50Z yonik $

Fields Summary
public static final int
STRING_INDEX
Indicator for StringIndex values in the cache.
public static FieldCache
DEFAULT
Expert: The cache used internally by sorting and range query classes.
Constructors Summary
Methods Summary
public java.lang.ObjectgetAuto(org.apache.lucene.index.IndexReader reader, java.lang.String field)
Checks the internal cache for an appropriate entry, and if none is found reads field to see if it contains integers, floats or strings, and then calls one of the other methods in this class to get the values. For string values, a StringIndex is returned. After calling this method, there is an entry in the cache for both type AUTO and the actual found type.

param
reader Used to get field values.
param
field Which field contains the values.
return
int[], float[] or StringIndex.
throws
IOException If any error occurs.

public java.lang.Comparable[]getCustom(org.apache.lucene.index.IndexReader reader, java.lang.String field, org.apache.lucene.search.SortComparator comparator)
Checks the internal cache for an appropriate entry, and if none is found reads the terms out of field and calls the given SortComparator to get the sort values. A hit in the cache will happen if reader, field, and comparator are the same (using equals()) as a previous call to this method.

param
reader Used to get field values.
param
field Which field contains the values.
param
comparator Used to convert terms into something to sort by.
return
Array of sort objects, one for each document.
throws
IOException If any error occurs.

public float[]getFloats(org.apache.lucene.index.IndexReader reader, java.lang.String field)
Checks the internal cache for an appropriate entry, and if none is found, reads the terms in field as floats and returns an array of size reader.maxDoc() of the value each document has in the given field.

param
reader Used to get field values.
param
field Which field contains the floats.
return
The values in the given field for each document.
throws
IOException If any error occurs.

public float[]getFloats(org.apache.lucene.index.IndexReader reader, java.lang.String field, org.apache.lucene.search.FieldCache$FloatParser parser)
Checks the internal cache for an appropriate entry, and if none is found, reads the terms in field as floats and returns an array of size reader.maxDoc() of the value each document has in the given field.

param
reader Used to get field values.
param
field Which field contains the floats.
param
parser Computes float for string values.
return
The values in the given field for each document.
throws
IOException If any error occurs.

public int[]getInts(org.apache.lucene.index.IndexReader reader, java.lang.String field)
Checks the internal cache for an appropriate entry, and if none is found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field.

param
reader Used to get field values.
param
field Which field contains the integers.
return
The values in the given field for each document.
throws
IOException If any error occurs.

public int[]getInts(org.apache.lucene.index.IndexReader reader, java.lang.String field, org.apache.lucene.search.FieldCache$IntParser parser)
Checks the internal cache for an appropriate entry, and if none is found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field.

param
reader Used to get field values.
param
field Which field contains the integers.
param
parser Computes integer for string values.
return
The values in the given field for each document.
throws
IOException If any error occurs.

public org.apache.lucene.search.FieldCache$StringIndexgetStringIndex(org.apache.lucene.index.IndexReader reader, java.lang.String field)
Checks the internal cache for an appropriate entry, and if none is found reads the term values in field and returns an array of them in natural order, along with an array telling which element in the term array each document uses.

param
reader Used to get field values.
param
field Which field contains the strings.
return
Array of terms and index into the array for each document.
throws
IOException If any error occurs.

public java.lang.String[]getStrings(org.apache.lucene.index.IndexReader reader, java.lang.String field)
Checks the internal cache for an appropriate entry, and if none is found, reads the term values in field and returns an array of size reader.maxDoc() containing the value each document has in the given field.

param
reader Used to get field values.
param
field Which field contains the strings.
return
The values in the given field for each document.
throws
IOException If any error occurs.