private static IndexEnvironment setupIndexer ( File outputDirectory , int memory , boolean storeDocs ) throws Exception { final IndexEnvironment env = new IndexEnvironment ( ) ; env . setMemory ( memory * ONE_MEGABYTE ) ; final Specification spec = env . getFileClassSpec ( "trectext" ) ; env . addFileClass ( spec ) ; env . setStoreDocs ( storeDocs ) ; // if we don't build indices on DOCNO then getting the docIds at query time is // extremely slow env . setMetadataIndexedFields ( new String [ ] { "docno" } , new String [ ] { "docno" } ) ; env . create ( outputDirectory . getAbsolutePath ( ) , statusMonitor ) ; return env ; }
because its only reference is in native code then we will get a crash .