code: public void init(Sort sort) {
          Log.debug("Initializing index");
          try {
              this.sort = sort;
  
              // Get directory file
              file = new File(path);
  
              // Open or create directory
              FSDirectory fsDirectory = FSDirectory.open(file);
              directory = new NRTCachingDirectory(fsDirectory, maxMergeMB, maxCachedMB);
  
              // Setup index writer
              IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_48, analyzer);
              config.setRAMBufferSizeMB(ramBufferMB);
              config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
              config.setUseCompoundFile(true);
              config.setMergePolicy(new SortingMergePolicy(config.getMergePolicy(), sort));
              indexWriter = new IndexWriter(directory, config);
  
              // Setup NRT search
              SearcherFactory searcherFactory = new SearcherFactory() {
                  public IndexSearcher newSearcher(IndexReader reader) throws IOException {
                      IndexSearcher searcher = new IndexSearcher(reader);
                      searcher.setSimilarity(new NoIDFSimilarity());
                      return searcher;
                  }
              };
              TrackingIndexWriter trackingIndexWriter = new TrackingIndexWriter(indexWriter);
              searcherManager = new SearcherManager(indexWriter, true, searcherFactory);
              searcherReopener = new ControlledRealTimeReopenThread<>(trackingIndexWriter,
                                                                      searcherManager,
                                                                      refreshSeconds,
                                                                      refreshSeconds);
              searcherReopener.start(); // Start the refresher thread
          } catch (IOException e) {
              Log.error(e, "Error while initializing index");
              throw new RuntimeException(e);
          }
      }
docs: Initializes this using the specified {@link Sort} for trying to keep the {@link Document}s sorted.
  
  @param sort The {@link Sort} to be used.