Hi Tom, There will be no clean way of doing this with scripts. A way would be to write a newSearcher event listener in Java and use one of the SolrIndexSearcher#getDocList methods to do the query. If successful, execute your scripts for snapshoot.
However, I think it should be fine if you want to execute snapshoot on the postOptimize hook. DataImportHandler will not call commit/optimize unless the import is successful. If you ever find a commit happening even when the import failed, then it must be a bug. On Tue, Aug 12, 2008 at 6:31 AM, Tom Morton <[EMAIL PROTECTED]> wrote: > Hi all, > I'm trying to check that an import using the dataImportHandler was clean > before I take a snapshot of the index to be pulled via snappuller to query > nodes. One of the checks I do is verify that a certain minimum number of > documents are returned for a query. I do this in a script that I'm calling > via the postOptimize hook. However, after a full import the numFound > results from the query are not accurate until after the postOptimize code > completes and so my checks are failing. > > Glancing at the code this looks non-trivial to "fix" as the hook call is > pretty deep in the call stack. > org.apache.solr.handler.dataimport.DataImporter.doFullImport execute > eventually calls > org.apache.solr.update.UpdateHandler.callPostOptimizeCallbacks > > One option would be to spawn and background a new job to check the status > with an initial sleep to wait for the postOptimize that spawned it to > finish. This is pretty ugly and could lead to some race conditions but > will > probably work. > > Any better recommendations on how to acheive this functionality? > > Thanks...Tom > -- Regards, Shalin Shekhar Mangar.