Source Code Cross Referenced for FieldCache.java in  » Net » lucene-connector » org » apache » lucene » search » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » lucene connector » org.apache.lucene.search 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.lucene.search;
002:
003:        /**
004:         * Licensed to the Apache Software Foundation (ASF) under one or more
005:         * contributor license agreements.  See the NOTICE file distributed with
006:         * this work for additional information regarding copyright ownership.
007:         * The ASF licenses this file to You under the Apache License, Version 2.0
008:         * (the "License"); you may not use this file except in compliance with
009:         * the License.  You may obtain a copy of the License at
010:         *
011:         *     http://www.apache.org/licenses/LICENSE-2.0
012:         *
013:         * Unless required by applicable law or agreed to in writing, software
014:         * distributed under the License is distributed on an "AS IS" BASIS,
015:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016:         * See the License for the specific language governing permissions and
017:         * limitations under the License.
018:         */
019:
020:        import org.apache.lucene.index.IndexReader;
021:        import java.io.IOException;
022:
023:        /**
024:         * Expert: Maintains caches of term values.
025:         *
026:         * <p>Created: May 19, 2004 11:13:14 AM
027:         *
028:         * @author  Tim Jones (Nacimiento Software)
029:         * @since   lucene 1.4
030:         * @version $Id: FieldCache.java 544546 2007-06-05 16:29:35Z doronc $
031:         */
032:        public interface FieldCache {
033:
034:            /** Indicator for StringIndex values in the cache. */
035:            // NOTE: the value assigned to this constant must not be
036:            // the same as any of those in SortField!!
037:            public static final int STRING_INDEX = -1;
038:
039:            /** Expert: Stores term text values and document ordering data. */
040:            public static class StringIndex {
041:
042:                /** All the term values, in natural order. */
043:                public final String[] lookup;
044:
045:                /** For each document, an index into the lookup array. */
046:                public final int[] order;
047:
048:                /** Creates one of these objects */
049:                public StringIndex(int[] values, String[] lookup) {
050:                    this .order = values;
051:                    this .lookup = lookup;
052:                }
053:            }
054:
055:            /** Interface to parse bytes from document fields.
056:             * @see FieldCache#getBytes(IndexReader, String, FieldCache.ByteParser)
057:             */
058:            public interface ByteParser {
059:                /** Return a single Byte representation of this field's value. */
060:                public byte parseByte(String string);
061:            }
062:
063:            /** Interface to parse shorts from document fields.
064:             * @see FieldCache#getShorts(IndexReader, String, FieldCache.ShortParser)
065:             */
066:            public interface ShortParser {
067:                /** Return a short representation of this field's value. */
068:                public short parseShort(String string);
069:            }
070:
071:            /** Interface to parse ints from document fields.
072:             * @see FieldCache#getInts(IndexReader, String, FieldCache.IntParser)
073:             */
074:            public interface IntParser {
075:                /** Return an integer representation of this field's value. */
076:                public int parseInt(String string);
077:            }
078:
079:            /** Interface to parse floats from document fields.
080:             * @see FieldCache#getFloats(IndexReader, String, FieldCache.FloatParser)
081:             */
082:            public interface FloatParser {
083:                /** Return an float representation of this field's value. */
084:                public float parseFloat(String string);
085:            }
086:
087:            /** Expert: The cache used internally by sorting and range query classes. */
088:            public static FieldCache DEFAULT = new FieldCacheImpl();
089:
090:            /** Checks the internal cache for an appropriate entry, and if none is
091:             * found, reads the terms in <code>field</code> as a single byte and returns an array
092:             * of size <code>reader.maxDoc()</code> of the value each document
093:             * has in the given field.
094:             * @param reader  Used to get field values.
095:             * @param field   Which field contains the single byte values.
096:             * @return The values in the given field for each document.
097:             * @throws IOException  If any error occurs.
098:             */
099:            public byte[] getBytes(IndexReader reader, String field)
100:                    throws IOException;
101:
102:            /** Checks the internal cache for an appropriate entry, and if none is found,
103:             * reads the terms in <code>field</code> as bytes and returns an array of
104:             * size <code>reader.maxDoc()</code> of the value each document has in the
105:             * given field.
106:             * @param reader  Used to get field values.
107:             * @param field   Which field contains the bytes.
108:             * @param parser  Computes byte for string values.
109:             * @return The values in the given field for each document.
110:             * @throws IOException  If any error occurs.
111:             */
112:            public byte[] getBytes(IndexReader reader, String field,
113:                    ByteParser parser) throws IOException;
114:
115:            /** Checks the internal cache for an appropriate entry, and if none is
116:             * found, reads the terms in <code>field</code> as shorts and returns an array
117:             * of size <code>reader.maxDoc()</code> of the value each document
118:             * has in the given field.
119:             * @param reader  Used to get field values.
120:             * @param field   Which field contains the shorts.
121:             * @return The values in the given field for each document.
122:             * @throws IOException  If any error occurs.
123:             */
124:            public short[] getShorts(IndexReader reader, String field)
125:                    throws IOException;
126:
127:            /** Checks the internal cache for an appropriate entry, and if none is found,
128:             * reads the terms in <code>field</code> as shorts and returns an array of
129:             * size <code>reader.maxDoc()</code> of the value each document has in the
130:             * given field.
131:             * @param reader  Used to get field values.
132:             * @param field   Which field contains the shorts.
133:             * @param parser  Computes short for string values.
134:             * @return The values in the given field for each document.
135:             * @throws IOException  If any error occurs.
136:             */
137:            public short[] getShorts(IndexReader reader, String field,
138:                    ShortParser parser) throws IOException;
139:
140:            /** Checks the internal cache for an appropriate entry, and if none is
141:             * found, reads the terms in <code>field</code> as integers and returns an array
142:             * of size <code>reader.maxDoc()</code> of the value each document
143:             * has in the given field.
144:             * @param reader  Used to get field values.
145:             * @param field   Which field contains the integers.
146:             * @return The values in the given field for each document.
147:             * @throws IOException  If any error occurs.
148:             */
149:            public int[] getInts(IndexReader reader, String field)
150:                    throws IOException;
151:
152:            /** Checks the internal cache for an appropriate entry, and if none is found,
153:             * reads the terms in <code>field</code> as integers and returns an array of
154:             * size <code>reader.maxDoc()</code> of the value each document has in the
155:             * given field.
156:             * @param reader  Used to get field values.
157:             * @param field   Which field contains the integers.
158:             * @param parser  Computes integer for string values.
159:             * @return The values in the given field for each document.
160:             * @throws IOException  If any error occurs.
161:             */
162:            public int[] getInts(IndexReader reader, String field,
163:                    IntParser parser) throws IOException;
164:
165:            /** Checks the internal cache for an appropriate entry, and if
166:             * none is found, reads the terms in <code>field</code> as floats and returns an array
167:             * of size <code>reader.maxDoc()</code> of the value each document
168:             * has in the given field.
169:             * @param reader  Used to get field values.
170:             * @param field   Which field contains the floats.
171:             * @return The values in the given field for each document.
172:             * @throws IOException  If any error occurs.
173:             */
174:            public float[] getFloats(IndexReader reader, String field)
175:                    throws IOException;
176:
177:            /** Checks the internal cache for an appropriate entry, and if
178:             * none is found, reads the terms in <code>field</code> as floats and returns an array
179:             * of size <code>reader.maxDoc()</code> of the value each document
180:             * has in the given field.
181:             * @param reader  Used to get field values.
182:             * @param field   Which field contains the floats.
183:             * @param parser  Computes float for string values.
184:             * @return The values in the given field for each document.
185:             * @throws IOException  If any error occurs.
186:             */
187:            public float[] getFloats(IndexReader reader, String field,
188:                    FloatParser parser) throws IOException;
189:
190:            /** Checks the internal cache for an appropriate entry, and if none
191:             * is found, reads the term values in <code>field</code> and returns an array
192:             * of size <code>reader.maxDoc()</code> containing the value each document
193:             * has in the given field.
194:             * @param reader  Used to get field values.
195:             * @param field   Which field contains the strings.
196:             * @return The values in the given field for each document.
197:             * @throws IOException  If any error occurs.
198:             */
199:            public String[] getStrings(IndexReader reader, String field)
200:                    throws IOException;
201:
202:            /** Checks the internal cache for an appropriate entry, and if none
203:             * is found reads the term values in <code>field</code> and returns
204:             * an array of them in natural order, along with an array telling
205:             * which element in the term array each document uses.
206:             * @param reader  Used to get field values.
207:             * @param field   Which field contains the strings.
208:             * @return Array of terms and index into the array for each document.
209:             * @throws IOException  If any error occurs.
210:             */
211:            public StringIndex getStringIndex(IndexReader reader, String field)
212:                    throws IOException;
213:
214:            /** Checks the internal cache for an appropriate entry, and if
215:             * none is found reads <code>field</code> to see if it contains integers, floats
216:             * or strings, and then calls one of the other methods in this class to get the
217:             * values.  For string values, a StringIndex is returned.  After
218:             * calling this method, there is an entry in the cache for both
219:             * type <code>AUTO</code> and the actual found type.
220:             * @param reader  Used to get field values.
221:             * @param field   Which field contains the values.
222:             * @return int[], float[] or StringIndex.
223:             * @throws IOException  If any error occurs.
224:             */
225:            public Object getAuto(IndexReader reader, String field)
226:                    throws IOException;
227:
228:            /** Checks the internal cache for an appropriate entry, and if none
229:             * is found reads the terms out of <code>field</code> and calls the given SortComparator
230:             * to get the sort values.  A hit in the cache will happen if <code>reader</code>,
231:             * <code>field</code>, and <code>comparator</code> are the same (using <code>equals()</code>)
232:             * as a previous call to this method.
233:             * @param reader  Used to get field values.
234:             * @param field   Which field contains the values.
235:             * @param comparator Used to convert terms into something to sort by.
236:             * @return Array of sort objects, one for each document.
237:             * @throws IOException  If any error occurs.
238:             */
239:            public Comparable[] getCustom(IndexReader reader, String field,
240:                    SortComparator comparator) throws IOException;
241:
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.