}
try {
Detector detector = DetectorFactory.create();
detector.append(inputDoc.getText());
lang = detector.detect();
inputDoc.getMetadata(true).put(languageMDKey, new Text(lang));
} catch (LangDetectException e) {
LOG.error("Exception on doc " + inputDoc.getUrl(), e);
lang = null;
}