void writeIndexData( IndexPackingRequest request, List<Integer> docIndexes, File targetArchive ) throws IOException { if ( targetArchive.exists() ) { targetArchive.delete(); } try ( OutputStream os = new FileOutputStream( targetArchive ) ) { IndexDataWriter dw = new IndexDataWriter( os ); dw.write( request.getContext(), request.getIndexReader(), docIndexes ); os.flush(); } }
void writeIndexData( IndexPackingRequest request, List<Integer> docIndexes, File targetArchive ) throws IOException { if ( targetArchive.exists() ) { targetArchive.delete(); } try ( OutputStream os = new FileOutputStream( targetArchive ) ) { IndexDataWriter dw = new IndexDataWriter( os ); dw.write( request.getContext(), request.getIndexReader(), docIndexes ); os.flush(); } }
void writeIndexData( IndexPackingRequest request, List<Integer> docIndexes, File targetArchive ) throws IOException { if ( targetArchive.exists() ) { targetArchive.delete(); } OutputStream os = null; try { os = new FileOutputStream( targetArchive ); IndexDataWriter dw = new IndexDataWriter( os ); dw.write( request.getContext(), request.getIndexReader(), docIndexes ); os.flush(); } finally { IOUtil.close( os ); } }
private List<Integer> getIndexChunk( IndexPackingRequest request, Date timestamp ) throws IOException { final List<Integer> chunk = new ArrayList<>(); final IndexReader r = request.getIndexReader(); Bits liveDocs = MultiFields.getLiveDocs( r ); for ( int i = 0; i < r.maxDoc(); i++ ) { if ( liveDocs == null || liveDocs.get( i ) ) { Document d = r.document( i ); String lastModified = d.get( ArtifactInfo.LAST_MODIFIED ); if ( lastModified != null ) { Date t = new Date( Long.parseLong( lastModified ) ); // Only add documents that were added after the last time we indexed if ( t.after( timestamp ) ) { chunk.add( i ); } } } } return chunk; }
private List<Integer> getIndexChunk( IndexPackingRequest request, Date timestamp ) throws IOException { final List<Integer> chunk = new ArrayList<>(); final IndexReader r = request.getIndexReader(); Bits liveDocs = MultiFields.getLiveDocs( r ); for ( int i = 0; i < r.maxDoc(); i++ ) { if ( liveDocs == null || liveDocs.get( i ) ) { Document d = r.document( i ); String lastModified = d.get( ArtifactInfo.LAST_MODIFIED ); if ( lastModified != null ) { Date t = new Date( Long.parseLong( lastModified ) ); // Only add documents that were added after the last time we indexed if ( t.after( timestamp ) ) { chunk.add( i ); } } } } return chunk; }
private List<Integer> getIndexChunk( IndexPackingRequest request, Date timestamp ) throws IOException { final List<Integer> chunk = new ArrayList<Integer>(); final IndexReader r = request.getIndexReader(); Bits liveDocs = MultiFields.getLiveDocs( r ); for ( int i = 0; i < r.maxDoc(); i++ ) { if ( liveDocs == null || liveDocs.get( i ) ) { Document d = r.document( i ); String lastModified = d.get( ArtifactInfo.LAST_MODIFIED ); if ( lastModified != null ) { Date t = new Date( Long.parseLong( lastModified ) ); // Only add documents that were added after the last time we indexed if ( t.after( timestamp ) ) { chunk.add( i ); } } } } return chunk; }