On Sat, Jun 22, 2013, at 03:40 AM, Chris Hostetter wrote: > > : This could be a very useful feature. To do it properly, you'd want some > : new update syntax, extending that of the atomic updates. That is, a new > : custom request handler could do it, but might now be the best way. > > the biggest complexity to implementing this in a general way would be > dealing with multi-node indexes in SolrCloud > > for single node indexes, the basic gist of what you'd want to do in a > custom handler would be something like... > > // you don't care about the DocList > DocSet docs = SolrIndexSearcher.execute(your query) > foreach docId in docs { > String docKey = fieldCache.lookup(docId) > SolrInputDocument newDoc; > newDoc.addField(uniqueKeyField, docKey) > newDoc.addField( ... your atomic update operation ...) > SolrCore.getUpdateProcessor().process(new AddDocCOmmand(newDoc)); > }
And what makes it complex across a multinode cluster? You'd need a method to push that query out to all shards, and then each shard would do the above. You'd need a rule that the unique key cannot be changed, otherwise the doc might need to switch shards, but that's probably the case already. Is there more to it than that? Upayavira