Source Code Cross Referenced for FilterIndexReader.java in  » Net » lucene-connector » org » apache » lucene » index » 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.index 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.lucene.index;
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.document.Document;
021:        import org.apache.lucene.document.FieldSelector;
022:        import org.apache.lucene.store.Directory;
023:
024:        import java.io.IOException;
025:        import java.util.Collection;
026:
027:        /**  A <code>FilterIndexReader</code> contains another IndexReader, which it
028:         * uses as its basic source of data, possibly transforming the data along the
029:         * way or providing additional functionality. The class
030:         * <code>FilterIndexReader</code> itself simply implements all abstract methods
031:         * of <code>IndexReader</code> with versions that pass all requests to the
032:         * contained index reader. Subclasses of <code>FilterIndexReader</code> may
033:         * further override some of these methods and may also provide additional
034:         * methods and fields.
035:         */
036:        public class FilterIndexReader extends IndexReader {
037:
038:            /** Base class for filtering {@link TermDocs} implementations. */
039:            public static class FilterTermDocs implements  TermDocs {
040:                protected TermDocs in;
041:
042:                public FilterTermDocs(TermDocs in) {
043:                    this .in = in;
044:                }
045:
046:                public void seek(Term term) throws IOException {
047:                    in.seek(term);
048:                }
049:
050:                public void seek(TermEnum termEnum) throws IOException {
051:                    in.seek(termEnum);
052:                }
053:
054:                public int doc() {
055:                    return in.doc();
056:                }
057:
058:                public int freq() {
059:                    return in.freq();
060:                }
061:
062:                public boolean next() throws IOException {
063:                    return in.next();
064:                }
065:
066:                public int read(int[] docs, int[] freqs) throws IOException {
067:                    return in.read(docs, freqs);
068:                }
069:
070:                public boolean skipTo(int i) throws IOException {
071:                    return in.skipTo(i);
072:                }
073:
074:                public void close() throws IOException {
075:                    in.close();
076:                }
077:            }
078:
079:            /** Base class for filtering {@link TermPositions} implementations. */
080:            public static class FilterTermPositions extends FilterTermDocs
081:                    implements  TermPositions {
082:
083:                public FilterTermPositions(TermPositions in) {
084:                    super (in);
085:                }
086:
087:                public int nextPosition() throws IOException {
088:                    return ((TermPositions) this .in).nextPosition();
089:                }
090:
091:                public int getPayloadLength() {
092:                    return ((TermPositions) this .in).getPayloadLength();
093:                }
094:
095:                public byte[] getPayload(byte[] data, int offset)
096:                        throws IOException {
097:                    return ((TermPositions) this .in).getPayload(data, offset);
098:                }
099:
100:                // TODO: Remove warning after API has been finalized
101:                public boolean isPayloadAvailable() {
102:                    return ((TermPositions) this .in).isPayloadAvailable();
103:                }
104:            }
105:
106:            /** Base class for filtering {@link TermEnum} implementations. */
107:            public static class FilterTermEnum extends TermEnum {
108:                protected TermEnum in;
109:
110:                public FilterTermEnum(TermEnum in) {
111:                    this .in = in;
112:                }
113:
114:                public boolean next() throws IOException {
115:                    return in.next();
116:                }
117:
118:                public Term term() {
119:                    return in.term();
120:                }
121:
122:                public int docFreq() {
123:                    return in.docFreq();
124:                }
125:
126:                public void close() throws IOException {
127:                    in.close();
128:                }
129:            }
130:
131:            protected IndexReader in;
132:
133:            /**
134:             * <p>Construct a FilterIndexReader based on the specified base reader.
135:             * Directory locking for delete, undeleteAll, and setNorm operations is
136:             * left to the base reader.</p>
137:             * <p>Note that base reader is closed if this FilterIndexReader is closed.</p>
138:             * @param in specified base reader.
139:             */
140:            public FilterIndexReader(IndexReader in) {
141:                super ();
142:                this .in = in;
143:            }
144:
145:            public Directory directory() {
146:                return in.directory();
147:            }
148:
149:            public TermFreqVector[] getTermFreqVectors(int docNumber)
150:                    throws IOException {
151:                ensureOpen();
152:                return in.getTermFreqVectors(docNumber);
153:            }
154:
155:            public TermFreqVector getTermFreqVector(int docNumber, String field)
156:                    throws IOException {
157:                ensureOpen();
158:                return in.getTermFreqVector(docNumber, field);
159:            }
160:
161:            public void getTermFreqVector(int docNumber, String field,
162:                    TermVectorMapper mapper) throws IOException {
163:                ensureOpen();
164:                in.getTermFreqVector(docNumber, field, mapper);
165:
166:            }
167:
168:            public void getTermFreqVector(int docNumber, TermVectorMapper mapper)
169:                    throws IOException {
170:                ensureOpen();
171:                in.getTermFreqVector(docNumber, mapper);
172:            }
173:
174:            public int numDocs() {
175:                // Don't call ensureOpen() here (it could affect performance)
176:                return in.numDocs();
177:            }
178:
179:            public int maxDoc() {
180:                // Don't call ensureOpen() here (it could affect performance)
181:                return in.maxDoc();
182:            }
183:
184:            public Document document(int n, FieldSelector fieldSelector)
185:                    throws CorruptIndexException, IOException {
186:                ensureOpen();
187:                return in.document(n, fieldSelector);
188:            }
189:
190:            public boolean isDeleted(int n) {
191:                // Don't call ensureOpen() here (it could affect performance)
192:                return in.isDeleted(n);
193:            }
194:
195:            public boolean hasDeletions() {
196:                // Don't call ensureOpen() here (it could affect performance)
197:                return in.hasDeletions();
198:            }
199:
200:            protected void doUndeleteAll() throws CorruptIndexException,
201:                    IOException {
202:                in.undeleteAll();
203:            }
204:
205:            public boolean hasNorms(String field) throws IOException {
206:                ensureOpen();
207:                return in.hasNorms(field);
208:            }
209:
210:            public byte[] norms(String f) throws IOException {
211:                ensureOpen();
212:                return in.norms(f);
213:            }
214:
215:            public void norms(String f, byte[] bytes, int offset)
216:                    throws IOException {
217:                ensureOpen();
218:                in.norms(f, bytes, offset);
219:            }
220:
221:            protected void doSetNorm(int d, String f, byte b)
222:                    throws CorruptIndexException, IOException {
223:                in.setNorm(d, f, b);
224:            }
225:
226:            public TermEnum terms() throws IOException {
227:                ensureOpen();
228:                return in.terms();
229:            }
230:
231:            public TermEnum terms(Term t) throws IOException {
232:                ensureOpen();
233:                return in.terms(t);
234:            }
235:
236:            public int docFreq(Term t) throws IOException {
237:                ensureOpen();
238:                return in.docFreq(t);
239:            }
240:
241:            public TermDocs termDocs() throws IOException {
242:                ensureOpen();
243:                return in.termDocs();
244:            }
245:
246:            public TermPositions termPositions() throws IOException {
247:                ensureOpen();
248:                return in.termPositions();
249:            }
250:
251:            protected void doDelete(int n) throws CorruptIndexException,
252:                    IOException {
253:                in.deleteDocument(n);
254:            }
255:
256:            protected void doCommit() throws IOException {
257:                in.commit();
258:            }
259:
260:            protected void doClose() throws IOException {
261:                in.close();
262:            }
263:
264:            public Collection getFieldNames(IndexReader.FieldOption fieldNames) {
265:                ensureOpen();
266:                return in.getFieldNames(fieldNames);
267:            }
268:
269:            public long getVersion() {
270:                ensureOpen();
271:                return in.getVersion();
272:            }
273:
274:            public boolean isCurrent() throws CorruptIndexException,
275:                    IOException {
276:                ensureOpen();
277:                return in.isCurrent();
278:            }
279:
280:            public boolean isOptimized() {
281:                ensureOpen();
282:                return in.isOptimized();
283:            }
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.