void SegmentMerger::createCompoundFile(const QString& filename, QStringList& files) { CompoundFileWriter* cfsWriter = _CLNEW CompoundFileWriter(directory, filename); { //msvc6 scope fix // Basic files for (int32_t i = 0; i < COMPOUND_EXTENSIONS_LENGTH; i++) { files.push_back(Misc::qjoin(segment, QLatin1String("."), QLatin1String(COMPOUND_EXTENSIONS+(i*4)))); } } { //msvc6 scope fix // Field norm files for (int32_t i = 0; i < fieldInfos->size(); i++) { FieldInfo* fi = fieldInfos->fieldInfo(i); if (fi->isIndexed && !fi->omitNorms) { TCHAR tbuf[10]; char abuf[10]; _i64tot(i, tbuf, 10); STRCPY_TtoA(abuf, tbuf, 10); files.push_back(Misc::qjoin(segment, QLatin1String(".f"), QLatin1String(abuf))); } } } // Vector files if (fieldInfos->hasVectors()) { for (int32_t i = 0; i < VECTOR_EXTENSIONS_LENGTH; i++) { files.push_back(Misc::qjoin(segment, QLatin1String("."), QLatin1String(VECTOR_EXTENSIONS+(i*4)))); } } { //msvc6 scope fix // Now merge all added files for (size_t i=0;i<files.size();i++) { cfsWriter->addFile(files[i]); } } // Perform the merge cfsWriter->close(); _CLDELETE(cfsWriter); }
void SegmentMerger::createCompoundFile(const char* filename, std::vector<std::string>* files){ CompoundFileWriter* cfsWriter = _CLNEW CompoundFileWriter(directory, filename, checkAbort); bool ownFiles = false; if ( files == NULL ){ files = new vector<string>; files->reserve(IndexFileNames::COMPOUND_EXTENSIONS().length + 1); ownFiles = true; } // Basic files for (int32_t i = 0; i < IndexFileNames::COMPOUND_EXTENSIONS().length; i++) { const char* ext = IndexFileNames::COMPOUND_EXTENSIONS()[i]; if (mergeDocStores || (strcmp(ext,IndexFileNames::FIELDS_EXTENSION) != 0 && strcmp(ext,IndexFileNames::FIELDS_INDEX_EXTENSION) != 0 ) ){ files->push_back ( string(segment) + "." + ext ); } } // Field norm files for (size_t i = 0; i < fieldInfos->size(); i++) { FieldInfo* fi = fieldInfos->fieldInfo(i); if (fi->isIndexed && !fi->omitNorms) { files->push_back ( segment + "." + IndexFileNames::NORMS_EXTENSION ); break; } } // Vector files if ( mergeDocStores && fieldInfos->hasVectors()) { for (int32_t i = 0; i < IndexFileNames::VECTOR_EXTENSIONS().length; i++) { files->push_back ( segment + "." + IndexFileNames::VECTOR_EXTENSIONS()[i] ); } } // Now merge all added files for ( size_t i=0;i<files->size();i++ ){ cfsWriter->addFile( (*files)[i].c_str()); } // Perform the merge cfsWriter->close(); _CLDELETE(cfsWriter); if ( ownFiles ) delete files; }