Source Code Cross Referenced for IndexFileNames.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:        /**
021:         * Useful constants representing filenames and extensions used by lucene
022:         * 
023:         * @author Bernhard Messer
024:         * @version $rcs = ' $Id: Exp $ ' ;
025:         */
026:        final class IndexFileNames {
027:
028:            /** Name of the index segment file */
029:            static final String SEGMENTS = "segments";
030:
031:            /** Name of the generation reference file name */
032:            static final String SEGMENTS_GEN = "segments.gen";
033:
034:            /** Name of the index deletable file (only used in
035:             * pre-lockless indices) */
036:            static final String DELETABLE = "deletable";
037:
038:            /** Extension of norms file */
039:            static final String NORMS_EXTENSION = "nrm";
040:
041:            /** Extension of freq postings file */
042:            static final String FREQ_EXTENSION = "frq";
043:
044:            /** Extension of prox postings file */
045:            static final String PROX_EXTENSION = "prx";
046:
047:            /** Extension of terms file */
048:            static final String TERMS_EXTENSION = "tis";
049:
050:            /** Extension of terms index file */
051:            static final String TERMS_INDEX_EXTENSION = "tii";
052:
053:            /** Extension of stored fields index file */
054:            static final String FIELDS_INDEX_EXTENSION = "fdx";
055:
056:            /** Extension of stored fields file */
057:            static final String FIELDS_EXTENSION = "fdt";
058:
059:            /** Extension of vectors fields file */
060:            static final String VECTORS_FIELDS_EXTENSION = "tvf";
061:
062:            /** Extension of vectors documents file */
063:            static final String VECTORS_DOCUMENTS_EXTENSION = "tvd";
064:
065:            /** Extension of vectors index file */
066:            static final String VECTORS_INDEX_EXTENSION = "tvx";
067:
068:            /** Extension of compound file */
069:            static final String COMPOUND_FILE_EXTENSION = "cfs";
070:
071:            /** Extension of compound file for doc store files*/
072:            static final String COMPOUND_FILE_STORE_EXTENSION = "cfx";
073:
074:            /** Extension of deletes */
075:            static final String DELETES_EXTENSION = "del";
076:
077:            /** Extension of field infos */
078:            static final String FIELD_INFOS_EXTENSION = "fnm";
079:
080:            /** Extension of plain norms */
081:            static final String PLAIN_NORMS_EXTENSION = "f";
082:
083:            /** Extension of separate norms */
084:            static final String SEPARATE_NORMS_EXTENSION = "s";
085:
086:            /** Extension of gen file */
087:            static final String GEN_EXTENSION = "gen";
088:
089:            /**
090:             * This array contains all filename extensions used by
091:             * Lucene's index files, with two exceptions, namely the
092:             * extension made up from <code>.f</code> + a number and
093:             * from <code>.s</code> + a number.  Also note that
094:             * Lucene's <code>segments_N</code> files do not have any
095:             * filename extension.
096:             */
097:            static final String INDEX_EXTENSIONS[] = new String[] {
098:                    COMPOUND_FILE_EXTENSION, FIELD_INFOS_EXTENSION,
099:                    FIELDS_INDEX_EXTENSION, FIELDS_EXTENSION,
100:                    TERMS_INDEX_EXTENSION, TERMS_EXTENSION, FREQ_EXTENSION,
101:                    PROX_EXTENSION, DELETES_EXTENSION, VECTORS_INDEX_EXTENSION,
102:                    VECTORS_DOCUMENTS_EXTENSION, VECTORS_FIELDS_EXTENSION,
103:                    GEN_EXTENSION, NORMS_EXTENSION,
104:                    COMPOUND_FILE_STORE_EXTENSION, };
105:
106:            /** File extensions that are added to a compound file
107:             * (same as above, minus "del", "gen", "cfs"). */
108:            static final String[] INDEX_EXTENSIONS_IN_COMPOUND_FILE = new String[] {
109:                    FIELD_INFOS_EXTENSION, FIELDS_INDEX_EXTENSION,
110:                    FIELDS_EXTENSION, TERMS_INDEX_EXTENSION, TERMS_EXTENSION,
111:                    FREQ_EXTENSION, PROX_EXTENSION, VECTORS_INDEX_EXTENSION,
112:                    VECTORS_DOCUMENTS_EXTENSION, VECTORS_FIELDS_EXTENSION,
113:                    NORMS_EXTENSION };
114:
115:            static final String[] STORE_INDEX_EXTENSIONS = new String[] {
116:                    VECTORS_INDEX_EXTENSION, VECTORS_FIELDS_EXTENSION,
117:                    VECTORS_DOCUMENTS_EXTENSION, FIELDS_INDEX_EXTENSION,
118:                    FIELDS_EXTENSION };
119:
120:            static final String[] NON_STORE_INDEX_EXTENSIONS = new String[] {
121:                    FIELD_INFOS_EXTENSION, FREQ_EXTENSION, PROX_EXTENSION,
122:                    TERMS_EXTENSION, TERMS_INDEX_EXTENSION, NORMS_EXTENSION };
123:
124:            /** File extensions of old-style index files */
125:            static final String COMPOUND_EXTENSIONS[] = new String[] {
126:                    FIELD_INFOS_EXTENSION, FREQ_EXTENSION, PROX_EXTENSION,
127:                    FIELDS_INDEX_EXTENSION, FIELDS_EXTENSION,
128:                    TERMS_INDEX_EXTENSION, TERMS_EXTENSION };
129:
130:            /** File extensions for term vector support */
131:            static final String VECTOR_EXTENSIONS[] = new String[] {
132:                    VECTORS_INDEX_EXTENSION, VECTORS_DOCUMENTS_EXTENSION,
133:                    VECTORS_FIELDS_EXTENSION };
134:
135:            /**
136:             * Computes the full file name from base, extension and
137:             * generation.  If the generation is -1, the file name is
138:             * null.  If it's 0, the file name is <base><extension>.
139:             * If it's > 0, the file name is <base>_<generation><extension>.
140:             *
141:             * @param base -- main part of the file name
142:             * @param extension -- extension of the filename (including .)
143:             * @param gen -- generation
144:             */
145:            static final String fileNameFromGeneration(String base,
146:                    String extension, long gen) {
147:                if (gen == SegmentInfo.NO) {
148:                    return null;
149:                } else if (gen == SegmentInfo.WITHOUT_GEN) {
150:                    return base + extension;
151:                } else {
152:                    return base + "_" + Long.toString(gen, Character.MAX_RADIX)
153:                            + extension;
154:                }
155:            }
156:
157:            /**
158:             * Returns true if the provided filename is one of the doc
159:             * store files (ends with an extension in
160:             * STORE_INDEX_EXTENSIONS).
161:             */
162:            static final boolean isDocStoreFile(String fileName) {
163:                if (fileName.endsWith(COMPOUND_FILE_STORE_EXTENSION))
164:                    return true;
165:                for (int i = 0; i < STORE_INDEX_EXTENSIONS.length; i++)
166:                    if (fileName.endsWith(STORE_INDEX_EXTENSIONS[i]))
167:                        return true;
168:                return false;
169:            }
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.