test_class.declarator: tempDir
test_class.modifier: private
test_class.original_string: private String tempDir;
test_class.type: String
test_class.var_name: tempDir
test_class.file: imhotep-server/src/test/java/com/indeed/flamdex/simple/TestSimpleFlamdexDocWriter.java
test_class.identifier: TestSimpleFlamdexDocWriter
test_case.body: @Test
      public void testBufferedOnly() throws IOException {
          final SimpleFlamdexDocWriter.Config config = new SimpleFlamdexDocWriter.Config().setDocBufferSize(999999999).setMergeFactor(999999999);
          writeFlamdex(tempDir, config);
          final FlamdexReader r = SimpleFlamdexReader.open(tempDir);
          assertTrue(r.getIntFields().size() == 2);
          assertTrue(r.getIntFields().contains("if1"));
          assertTrue(r.getIntFields().contains("if2"));
          assertTrue(r.getStringFields().size() == 2);
          assertTrue(r.getStringFields().contains("sf1"));
          assertTrue(r.getStringFields().contains("sf2"));
  
          DocIdStream dis = r.getDocIdStream();
          int[] docIdBuffer = new int[64];
          IntTermIterator iter = r.getIntTermIterator("if1");
          assertTrue(iter.next());
          assertEquals(0, iter.term());
          assertEquals(2, iter.docFreq());
          dis.reset(iter);
          assertEquals(2, dis.fillDocIdBuffer(docIdBuffer));
          assertEquals(Ints.asList(0, 3), Ints.asList(docIdBuffer).subList(0, 2));
          assertTrue(iter.next());
          assertEquals(5, iter.term());
          assertEquals(1, iter.docFreq());
          dis.reset(iter);
          assertEquals(1, dis.fillDocIdBuffer(docIdBuffer));
          assertEquals(Ints.asList(0), Ints.asList(docIdBuffer).subList(0, 1));
          iter.close();
      }
test_case.class_method_signature: TestSimpleFlamdexDocWriter.testBufferedOnly()
test_case.full_signature: @Test public void testBufferedOnly()
test_case.identifier: testBufferedOnly
test_case.invocations: setMergeFactor setDocBufferSize writeFlamdex open assertTrue size getIntFields assertTrue contains getIntFields assertTrue contains getIntFields assertTrue size getStringFields assertTrue contains getStringFields assertTrue contains getStringFields getDocIdStream getIntTermIterator assertTrue next assertEquals term assertEquals docFreq reset assertEquals fillDocIdBuffer assertEquals asList subList asList assertTrue next assertEquals term assertEquals docFreq reset assertEquals fillDocIdBuffer assertEquals asList subList asList close
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBufferedOnly()
focal_class.declarator: outputDirectory
focal_class.modifier: private final
focal_class.original_string: private final String outputDirectory;
focal_class.type: String
focal_class.var_name: outputDirectory
focal_class.declarator: docBufferSize
focal_class.modifier: private final
focal_class.original_string: private final int docBufferSize;
focal_class.type: int
focal_class.var_name: docBufferSize
focal_class.declarator: mergeFactor
focal_class.modifier: private final
focal_class.original_string: private final int mergeFactor;
focal_class.type: int
focal_class.var_name: mergeFactor
focal_class.declarator: segmentsOnDisk
focal_class.modifier: private final
focal_class.original_string: private final List<List<File>> segmentsOnDisk;
focal_class.type: List<List<File>>
focal_class.var_name: segmentsOnDisk
focal_class.declarator: currentBuffer = new MemoryFlamdex()
focal_class.modifier: private
focal_class.original_string: private MemoryFlamdex currentBuffer = new MemoryFlamdex();
focal_class.type: MemoryFlamdex
focal_class.var_name: currentBuffer
focal_class.declarator: currentSegment = "_0"
focal_class.modifier: private
focal_class.original_string: private String currentSegment = "_0";
focal_class.type: String
focal_class.var_name: currentSegment
focal_class.file: imhotep-server/src/main/java/com/indeed/flamdex/simple/SimpleFlamdexDocWriter.java
focal_class.identifier: SimpleFlamdexDocWriter
focal_class.interfaces: implements FlamdexDocWriter
focal_class.class_method_signature: SimpleFlamdexDocWriter.SimpleFlamdexDocWriter(String outputDirectory, Config config)
focal_class.full_signature: public  SimpleFlamdexDocWriter(String outputDirectory, Config config)
focal_class.identifier: SimpleFlamdexDocWriter
focal_class.modifiers: public
focal_class.parameters: (String outputDirectory, Config config)
focal_class.signature:  SimpleFlamdexDocWriter(String outputDirectory, Config config)
focal_class.class_method_signature: SimpleFlamdexDocWriter.createOutputDir(String outputDirectory)
focal_class.full_signature: private static void createOutputDir(String outputDirectory)
focal_class.identifier: createOutputDir
focal_class.modifiers: private static
focal_class.parameters: (String outputDirectory)
focal_class.return: void
focal_class.signature: void createOutputDir(String outputDirectory)
focal_class.class_method_signature: SimpleFlamdexDocWriter.addDocument(FlamdexDocument doc)
focal_class.full_signature: @Override public void addDocument(FlamdexDocument doc)
focal_class.identifier: addDocument
focal_class.modifiers: @Override public
focal_class.parameters: (FlamdexDocument doc)
focal_class.return: void
focal_class.signature: void addDocument(FlamdexDocument doc)
focal_class.class_method_signature: SimpleFlamdexDocWriter.flush()
focal_class.full_signature: private void flush()
focal_class.identifier: flush
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void flush()
focal_class.class_method_signature: SimpleFlamdexDocWriter.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: SimpleFlamdexDocWriter.nextSegmentDirectory(String s)
focal_class.full_signature: private static String nextSegmentDirectory(String s)
focal_class.identifier: nextSegmentDirectory
focal_class.modifiers: private static
focal_class.parameters: (String s)
focal_class.return: String
focal_class.signature: String nextSegmentDirectory(String s)
focal_class.class_method_signature: SimpleFlamdexDocWriter.rmrf(final File file)
focal_class.full_signature: private static void rmrf(final File file)
focal_class.identifier: rmrf
focal_class.modifiers: private static
focal_class.parameters: (final File file)
focal_class.return: void
focal_class.signature: void rmrf(final File file)
focal_method.body: @Override
      public void close() throws IOException {
          flush();
          long numDocs = 0;
          final List<FlamdexReader> allReaders = Lists.newArrayList();
          for (final File file : Iterables.concat(Lists.reverse(segmentsOnDisk.subList(1, segmentsOnDisk.size())))) {
              final SimpleFlamdexReader reader = SimpleFlamdexReader.open(file.getAbsolutePath(), new SimpleFlamdexReader.Config().setWriteBTreesIfNotExisting(false));
              allReaders.add(reader);
              numDocs += reader.getNumDocs();
          }
          for (final File file : segmentsOnDisk.get(0)) {
              final FlamdexReader reader = MemoryFlamdex.streamer(new BufferedFileDataInputStream(file, ByteOrder.nativeOrder(), 65536));
              allReaders.add(reader);
              numDocs += reader.getNumDocs();
          }
  
          final FlamdexWriter w = new SimpleFlamdexWriter(outputDirectory, numDocs, true, true);
          SimpleFlamdexWriter.merge(allReaders, w);
          w.close();
  
          for (final FlamdexReader reader : allReaders) {
              reader.close();
          }
  
          for (final File file : Iterables.concat(segmentsOnDisk)) {
              rmrf(file);
          }
      }
focal_method.class_method_signature: SimpleFlamdexDocWriter.close()
focal_method.full_signature: @Override public void close()
focal_method.identifier: close
focal_method.invocations: flush newArrayList concat reverse subList size open getAbsolutePath setWriteBTreesIfNotExisting add getNumDocs get streamer nativeOrder add getNumDocs merge close close concat rmrf
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void close()