Fixing Solr error “no segments* file found in NRTCachingDirectory”

If you try to run a Solr DataImportHandler by running HTTP commands (e.g. from a build script), you may hit an error like this:

"no segments* file found in NRTCachingDirectory"

It appears that this indicates that Solr didn’t initialize properly. You can fix this by adding a second request, to hit the core directly:

http://localhost:8080/solr/#/core/dataimport//dataimport