01: package org.apache.lucene.search;
02:
03: import org.apache.lucene.index.IndexReader;
04:
05: import java.io.IOException;
06:
07: /**
08: *
09: *
10: **/
11: public interface ExtendedFieldCache extends FieldCache {
12: public interface LongParser {
13: /**
14: * Return an long representation of this field's value.
15: */
16: public long parseLong(String string);
17: }
18:
19: public interface DoubleParser {
20: /**
21: * Return an long representation of this field's value.
22: */
23: public double parseDouble(String string);
24: }
25:
26: public static ExtendedFieldCache EXT_DEFAULT = new ExtendedFieldCacheImpl();
27:
28: /**
29: * Checks the internal cache for an appropriate entry, and if none is
30: * found, reads the terms in <code>field</code> as longs and returns an array
31: * of size <code>reader.maxDoc()</code> of the value each document
32: * has in the given field.
33: *
34: * @param reader Used to get field values.
35: * @param field Which field contains the longs.
36: * @return The values in the given field for each document.
37: * @throws java.io.IOException If any error occurs.
38: */
39: public long[] getLongs(IndexReader reader, String field)
40: throws IOException;
41:
42: /**
43: * Checks the internal cache for an appropriate entry, and if none is found,
44: * reads the terms in <code>field</code> as longs and returns an array of
45: * size <code>reader.maxDoc()</code> of the value each document has in the
46: * given field.
47: *
48: * @param reader Used to get field values.
49: * @param field Which field contains the longs.
50: * @param parser Computes integer for string values.
51: * @return The values in the given field for each document.
52: * @throws IOException If any error occurs.
53: */
54: public long[] getLongs(IndexReader reader, String field,
55: LongParser parser) throws IOException;
56:
57: /**
58: * Checks the internal cache for an appropriate entry, and if none is
59: * found, reads the terms in <code>field</code> as integers and returns an array
60: * of size <code>reader.maxDoc()</code> of the value each document
61: * has in the given field.
62: *
63: * @param reader Used to get field values.
64: * @param field Which field contains the doubles.
65: * @return The values in the given field for each document.
66: * @throws IOException If any error occurs.
67: */
68: public double[] getDoubles(IndexReader reader, String field)
69: throws IOException;
70:
71: /**
72: * Checks the internal cache for an appropriate entry, and if none is found,
73: * reads the terms in <code>field</code> as doubles and returns an array of
74: * size <code>reader.maxDoc()</code> of the value each document has in the
75: * given field.
76: *
77: * @param reader Used to get field values.
78: * @param field Which field contains the doubles.
79: * @param parser Computes integer for string values.
80: * @return The values in the given field for each document.
81: * @throws IOException If any error occurs.
82: */
83: public double[] getDoubles(IndexReader reader, String field,
84: DoubleParser parser) throws IOException;
85: }
|