org.apache.lucene.search
Interface FieldCache
-
- All Known Subinterfaces:
- ExtendedFieldCache
public interface FieldCacheExpert: Maintains caches of term values.Created: May 19, 2004 11:13:14 AM
- Since:
- lucene 1.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interfaceFieldCache.ByteParserInterface to parse bytes from document fields.static interfaceFieldCache.FloatParserInterface to parse floats from document fields.static interfaceFieldCache.IntParserInterface to parse ints from document fields.static interfaceFieldCache.ShortParserInterface to parse shorts from document fields.static classFieldCache.StringIndexExpert: Stores term text values and document ordering data.
-
Field Summary
Fields Modifier and Type Field and Description static FieldCacheDEFAULTExpert: The cache used internally by sorting and range query classes.static intSTRING_INDEXIndicator for StringIndex values in the cache.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description java.lang.ObjectgetAuto(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found readsfieldto see if it contains integers, floats or strings, and then calls one of the other methods in this class to get the values.byte[]getBytes(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas a single byte and returns an array of sizereader.maxDoc()of the value each document has in the given field.byte[]getBytes(IndexReader reader, java.lang.String field, FieldCache.ByteParser parser)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas bytes and returns an array of sizereader.maxDoc()of the value each document has in the given field.java.lang.Comparable[]getCustom(IndexReader reader, java.lang.String field, SortComparator comparator)Checks the internal cache for an appropriate entry, and if none is found reads the terms out offieldand calls the given SortComparator to get the sort values.float[]getFloats(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas floats and returns an array of sizereader.maxDoc()of the value each document has in the given field.float[]getFloats(IndexReader reader, java.lang.String field, FieldCache.FloatParser parser)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas floats and returns an array of sizereader.maxDoc()of the value each document has in the given field.int[]getInts(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas integers and returns an array of sizereader.maxDoc()of the value each document has in the given field.int[]getInts(IndexReader reader, java.lang.String field, FieldCache.IntParser parser)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas integers and returns an array of sizereader.maxDoc()of the value each document has in the given field.short[]getShorts(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas shorts and returns an array of sizereader.maxDoc()of the value each document has in the given field.short[]getShorts(IndexReader reader, java.lang.String field, FieldCache.ShortParser parser)Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas shorts and returns an array of sizereader.maxDoc()of the value each document has in the given field.FieldCache.StringIndexgetStringIndex(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found reads the term values infieldand returns an array of them in natural order, along with an array telling which element in the term array each document uses.java.lang.String[]getStrings(IndexReader reader, java.lang.String field)Checks the internal cache for an appropriate entry, and if none is found, reads the term values infieldand returns an array of sizereader.maxDoc()containing the value each document has in the given field.
-
-
-
Field Detail
-
STRING_INDEX
static final int STRING_INDEX
Indicator for StringIndex values in the cache.- See Also:
- Constant Field Values
-
DEFAULT
static final FieldCache DEFAULT
Expert: The cache used internally by sorting and range query classes.
-
-
Method Detail
-
getBytes
byte[] getBytes(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas a single byte and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the single byte values.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getBytes
byte[] getBytes(IndexReader reader, java.lang.String field, FieldCache.ByteParser parser) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas bytes and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the bytes.parser- Computes byte for string values.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getShorts
short[] getShorts(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas shorts and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the shorts.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getShorts
short[] getShorts(IndexReader reader, java.lang.String field, FieldCache.ShortParser parser) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas shorts and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the shorts.parser- Computes short for string values.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getInts
int[] getInts(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas integers and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the integers.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getInts
int[] getInts(IndexReader reader, java.lang.String field, FieldCache.IntParser parser) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas integers and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the integers.parser- Computes integer for string values.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getFloats
float[] getFloats(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas floats and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the floats.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getFloats
float[] getFloats(IndexReader reader, java.lang.String field, FieldCache.FloatParser parser) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms infieldas floats and returns an array of sizereader.maxDoc()of the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the floats.parser- Computes float for string values.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getStrings
java.lang.String[] getStrings(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infieldand returns an array of sizereader.maxDoc()containing the value each document has in the given field.- Parameters:
reader- Used to get field values.field- Which field contains the strings.- Returns:
- The values in the given field for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getStringIndex
FieldCache.StringIndex getStringIndex(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found reads the term values infieldand returns an array of them in natural order, along with an array telling which element in the term array each document uses.- Parameters:
reader- Used to get field values.field- Which field contains the strings.- Returns:
- Array of terms and index into the array for each document.
- Throws:
java.io.IOException- If any error occurs.
-
getAuto
java.lang.Object getAuto(IndexReader reader, java.lang.String field) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found readsfieldto 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 typeAUTOand the actual found type.- Parameters:
reader- Used to get field values.field- Which field contains the values.- Returns:
- int[], float[] or StringIndex.
- Throws:
java.io.IOException- If any error occurs.
-
getCustom
java.lang.Comparable[] getCustom(IndexReader reader, java.lang.String field, SortComparator comparator) throws java.io.IOException
Checks the internal cache for an appropriate entry, and if none is found reads the terms out offieldand calls the given SortComparator to get the sort values. A hit in the cache will happen ifreader,field, andcomparatorare the same (usingequals()) as a previous call to this method.- Parameters:
reader- Used to get field values.field- Which field contains the values.comparator- Used to convert terms into something to sort by.- Returns:
- Array of sort objects, one for each document.
- Throws:
java.io.IOException- If any error occurs.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG