public DocnoMapping getDocnoMapping() throws IOException {
return loadDocnoMapping(indexPath, fs);
}
public static DocnoMapping loadDocnoMapping(String indexPath, FileSystem fs) throws IOException {
DocnoMapping mDocMapping = null;
// load the docid to docno mappings
try {
LOG.info("Loading DocnoMapping file...");
RetrievalEnvironment env = new RetrievalEnvironment(indexPath, fs);
String className = env.readDocnoMappingClass();
LOG.info(" - Class name: " + className);
mDocMapping = (DocnoMapping) Class.forName(className).newInstance();
Path mappingFile = env.getDocnoMappingData();
LOG.info(" - File name: " + mappingFile);
mDocMapping.loadMapping(mappingFile, fs);
LOG.info("Done!");
} catch (Exception e) {
throw new IOException("Error initializing DocnoMapping!");
}
return mDocMapping;