Hi all, This is my use case: I have a stored field, field_a, which is atomic updated (let's say by "inc"). field_a is stored but not indexed due to the large number of distinct values it can have. I need to index field_b (I need facet and stats on it) which is not in the document but its value is based on a calculation of the recent (e.g. summed) value of field_a. There is no way to do it nowadays. So I thought of a new method: custom atomic update.
There will be a new interface in Solr: public interface CustomAtomicUpdater { public void update(SolrInputDocument oldDoc, String fieldName, Object fieldVal) ; } There will be a new attribute for fields in schema.xml called "customAtomicUpdateClass" (and all support in code, of course). The value is a class which is an implementation of CustomAtomicUpdater. In our example it will be defined for field_a. In method "getUpdatedDocument" in DistributedUpdateProcessor.java, we will add handling of "custom" case: } else if ("custom".equals(key)) { updateField = true; SchemaField sf = schema.getField(sif.getName()); String customAtomicUpdaterClassName = sf.getCustomAtomicUpdaterClass(); if (customAtomicUpdaterClassName == null) { throw new SolrException(ErrorCode.BAD_REQUEST, "There is no customAtomicUpdaterClass defined for " + sif + "."); } CustomAtomicUpdater updater = schema.getResourceLoader() .newInstance(customAtomicUpdaterClassName, CustomAtomicUpdater.class); if (updater == null) { throw new SolrException(ErrorCode.BAD_REQUEST, "Was unable to create instance of " + customAtomicUpdaterClassName + "."); } updater.update(oldDoc, sif.getName(), fieldVal); } In my implementation I will sum field_a (oldvalue + newvalue) and update field_b according to my logic. Example of use: <add> <doc> <field name="field_a" update="custom">128</field> </doc> </add> What do say about my suggestion? Thanks.