in alerting/service/src/main/java/org/apache/karaf/decanter/alerting/service/store/LuceneStoreImpl.java [192:218]
private void store(Alert alert) throws Exception {
Document document = new Document();
for (String key : alert.get().keySet()) {
Object value = alert.get(key);
if (value instanceof Long) {
document.add(new LongPoint(key, ((Long) value)));
document.add(new StoredField(key, ((Long) value)));
points.put(key, new PointsConfig(NumberFormat.getInstance(), Long.class));
} else if (value instanceof Integer) {
document.add(new IntPoint(key, ((Integer) value)));
document.add(new StoredField(key, ((Integer) value)));
points.put(key, new PointsConfig(NumberFormat.getInstance(), Integer.class));
} else if (value instanceof Float) {
document.add(new FloatPoint(key, ((Float) value)));
document.add(new StoredField(key, ((Integer) value)));
points.put(key, new PointsConfig(NumberFormat.getInstance(), Float.class));
} else if (value instanceof Double) {
document.add(new DoublePoint(key, ((Double) value)));
document.add(new StoredField(key, ((Double) value)));
points.put(key, new PointsConfig(NumberFormat.getInstance(), Double.class));
} else {
document.add(new StringField(key, value.toString(), Field.Store.YES));
}
}
indexWriter.addDocument(document);
indexWriter.commit();
}