1 ///////////////////////////////////////////////////////////////////////////// 2 // Copyright (c) 2009-2014 Alan Wright. All rights reserved. 3 // Distributable under the terms of either the Apache License (Version 2.0) 4 // or the GNU Lesser General Public License. 5 ///////////////////////////////////////////////////////////////////////////// 6 7 #ifndef INDEXFILENAMES_H 8 #define INDEXFILENAMES_H 9 10 #include "LuceneObject.h" 11 12 namespace Lucene { 13 14 /// Constants representing filenames and extensions used by Lucene. 15 class LPPAPI IndexFileNames : public LuceneObject { 16 public: 17 virtual ~IndexFileNames(); 18 LUCENE_CLASS(IndexFileNames); 19 20 public: 21 /// Name of the index segment file. 22 static const String& SEGMENTS(); 23 24 /// Name of the generation reference file name. 25 static const String& SEGMENTS_GEN(); 26 27 /// Name of the index deletable file (only used in pre-lockless indices). 28 static const String& DELETABLE(); 29 30 /// Extension of norms file. 31 static const String& NORMS_EXTENSION(); 32 33 /// Extension of freq postings file. 34 static const String& FREQ_EXTENSION(); 35 36 /// Extension of prox postings file. 37 static const String& PROX_EXTENSION(); 38 39 /// Extension of terms file. 40 static const String& TERMS_EXTENSION(); 41 42 /// Extension of terms index file. 43 static const String& TERMS_INDEX_EXTENSION(); 44 45 /// Extension of stored fields index file. 46 static const String& FIELDS_INDEX_EXTENSION(); 47 48 /// Extension of stored fields file. 49 static const String& FIELDS_EXTENSION(); 50 51 /// Extension of vectors fields file. 52 static const String& VECTORS_FIELDS_EXTENSION(); 53 54 /// Extension of vectors documents file. 55 static const String& VECTORS_DOCUMENTS_EXTENSION(); 56 57 /// Extension of vectors index file. 58 static const String& VECTORS_INDEX_EXTENSION(); 59 60 /// Extension of compound file. 61 static const String& COMPOUND_FILE_EXTENSION(); 62 63 /// Extension of compound file for doc store files. 64 static const String& COMPOUND_FILE_STORE_EXTENSION(); 65 66 /// Extension of deletes. 67 static const String& DELETES_EXTENSION(); 68 69 /// Extension of field infos. 70 static const String& FIELD_INFOS_EXTENSION(); 71 72 /// Extension of plain norms. 73 static const String& PLAIN_NORMS_EXTENSION(); 74 75 /// Extension of separate norms. 76 static const String& SEPARATE_NORMS_EXTENSION(); 77 78 /// Extension of gen file. 79 static const String& GEN_EXTENSION(); 80 81 /// This array contains all filename extensions used by Lucene's index 82 /// files, with two exceptions, namely the extension made up from 83 /// ".f" + number and from ".s" + number. Also note that Lucene's 84 /// "segments_N" files do not have any filename extension. 85 static const HashSet<String> INDEX_EXTENSIONS(); 86 87 /// File extensions that are added to a compound file (same as 88 /// {@link #INDEX_EXTENSIONS}, minus "del", "gen", "cfs"). 89 static const HashSet<String> INDEX_EXTENSIONS_IN_COMPOUND_FILE(); 90 91 static const HashSet<String> STORE_INDEX_EXTENSIONS(); 92 static const HashSet<String> NON_STORE_INDEX_EXTENSIONS(); 93 94 /// File extensions of old-style index files. 95 static const HashSet<String> COMPOUND_EXTENSIONS(); 96 97 /// File extensions for term vector support. 98 static const HashSet<String> VECTOR_EXTENSIONS(); 99 100 /// Computes the full file name from base, extension and generation. 101 /// If the generation is {@link SegmentInfo#NO}, the file name is null. 102 /// If it's {@link SegmentInfo#WITHOUT_GEN} the file name is base+extension. 103 /// If it's > 0, the file name is base_generation+extension. 104 static String fileNameFromGeneration(const String& base, const String& extension, int64_t gen); 105 106 /// Returns true if the provided filename is one of the doc store files 107 /// (ends with an extension in STORE_INDEX_EXTENSIONS). 108 static bool isDocStoreFile(const String& fileName); 109 110 /// Return segment file name. 111 static String segmentFileName(const String& segmentName, const String& ext); 112 }; 113 114 } 115 116 #endif 117