久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <i id='YdYSq'><tr id='YdYSq'><dt id='YdYSq'><q id='YdYSq'><span id='YdYSq'><b id='YdYSq'><form id='YdYSq'><ins id='YdYSq'></ins><ul id='YdYSq'></ul><sub id='YdYSq'></sub></form><legend id='YdYSq'></legend><bdo id='YdYSq'><pre id='YdYSq'><center id='YdYSq'></center></pre></bdo></b><th id='YdYSq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YdYSq'><tfoot id='YdYSq'></tfoot><dl id='YdYSq'><fieldset id='YdYSq'></fieldset></dl></div>
    1. <small id='YdYSq'></small><noframes id='YdYSq'>

      • <bdo id='YdYSq'></bdo><ul id='YdYSq'></ul>

      <legend id='YdYSq'><style id='YdYSq'><dir id='YdYSq'><q id='YdYSq'></q></dir></style></legend>

    2. <tfoot id='YdYSq'></tfoot>

        如何在lucene中將RAMDirectory集成到FSDirectory

        how to integrate RAMDirectory into FSDirectory in lucene(如何在lucene中將RAMDirectory集成到FSDirectory)
        <legend id='sxTdP'><style id='sxTdP'><dir id='sxTdP'><q id='sxTdP'></q></dir></style></legend>

            <small id='sxTdP'></small><noframes id='sxTdP'>

                <bdo id='sxTdP'></bdo><ul id='sxTdP'></ul>
              • <i id='sxTdP'><tr id='sxTdP'><dt id='sxTdP'><q id='sxTdP'><span id='sxTdP'><b id='sxTdP'><form id='sxTdP'><ins id='sxTdP'></ins><ul id='sxTdP'></ul><sub id='sxTdP'></sub></form><legend id='sxTdP'></legend><bdo id='sxTdP'><pre id='sxTdP'><center id='sxTdP'></center></pre></bdo></b><th id='sxTdP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sxTdP'><tfoot id='sxTdP'></tfoot><dl id='sxTdP'><fieldset id='sxTdP'></fieldset></dl></div>

                  <tbody id='sxTdP'></tbody>
                1. <tfoot id='sxTdP'></tfoot>
                2. 本文介紹了如何在lucene中將RAMDirectory集成到FSDirectory的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我現在有一個問題,這個是關于 lucene 的.我試圖制作一個可以進行索引并將它們首先存儲在內存中的 lucene 源代碼使用 RAMDirectory,然后將內存中的該索引刷新到磁盤中使用 FSDirectory.我對這段代碼做了一些修改,但是徒勞無功.也許你們中的一些人可以幫幫我.

                  I had a question now, this one regarding lucene. I was trying to make a lucene source code that can do indexing and store them first in a memory using RAMDirectory and then flush this index in a memory into a disk using FSDirectory. I had done some modifications of this code but to no avail. maybe some of you can help me out a bit.

                  那么對我來說,將 RAMDirectory 集成到此源中的最佳方式是什么?將它們放入 FSDirectory 之前的代碼.任何幫助,將不勝感激盡管這是源代碼.

                  so what's the best way for me to integrate RAMDirectory in this source code before putting them in FSDirectory. any help would be appreciated though here is the source code.

                  import org.apache.lucene.analysis.SimpleAnalyzer;
                  import org.apache.lucene.document.Document;
                  import org.apache.lucene.document.Field;
                  import org.apache.lucene.index.IndexWriter;
                  import org.apache.lucene.store.FSDirectory;
                  
                  import java.io.File;
                  import java.io.FileReader;
                  import java.io.IOException;
                  
                  public class SimpleFileIndexer {
                      public static void main(String[] args) throws Exception {
                          File indexDir = new File("C:/Users/Raden/Documents/lucene/LuceneHibernate/adi");
                          File dataDir = new File("C:/Users/Raden/Documents/lucene/LuceneHibernate/adi");
                          String suffix = "txt";
                          SimpleFileIndexer indexer = new SimpleFileIndexer();
                          int numIndex = indexer.index(indexDir, dataDir, suffix);
                          System.out.println("Total files indexed " + numIndex);
                      }
                  
                      private int index(File indexDir, File dataDir, String suffix) throws Exception {
                          IndexWriter indexWriter = new IndexWriter(
                                  FSDirectory.open(indexDir),
                                  new SimpleAnalyzer(),
                                  true,
                                  IndexWriter.MaxFieldLength.LIMITED);
                          indexWriter.setUseCompoundFile(false);
                          indexDirectory(indexWriter, dataDir, suffix);
                          int numIndexed = indexWriter.maxDoc();
                          indexWriter.optimize();
                          indexWriter.close();
                          return numIndexed;
                      }
                  
                      private void indexDirectory(IndexWriter indexWriter, File dataDir, String suffix) throws IOException {
                          File[] files = dataDir.listFiles();
                          for (int i = 0; i < files.length; i++) {
                              File f = files[i];
                              if (f.isDirectory()) {
                                  indexDirectory(indexWriter, f, suffix);
                              } else {
                                  indexFileWithIndexWriter(indexWriter, f, suffix);
                              }
                          }
                      }
                  
                      private void indexFileWithIndexWriter(IndexWriter indexWriter, File f, String suffix) throws IOException {
                          if (f.isHidden() || f.isDirectory() || !f.canRead() || !f.exists()) {
                              return;
                          }
                          if (suffix != null && !f.getName().endsWith(suffix)) {
                              return;
                          }
                          System.out.println("Indexing file " + f.getCanonicalPath());
                          Document doc = new Document();
                          doc.add(new Field("contents", new FileReader(f)));
                          doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES, Field.Index.ANALYZED));
                          indexWriter.addDocument(doc);
                      }
                  }
                  

                  推薦答案

                  我不確定這樣做是否會獲得任何性能提升,但你可以在 RAMDirectory 上完成所有索引 然后將目錄復制到 FSDirectory.

                  I'm not really sure that you'll get any performance gain from doing this, but you could do all the indexing on a RAMDirectory and then copy the directory to an FSDirectory.

                  像這樣:

                  private int index(File indexDir, File dataDir, String suffix) throws Exception {
                      RAMDirectory ramDir = new RAMDirectory();          // 1
                      IndexWriter indexWriter = new IndexWriter(
                              ramDir,                                    // 2
                              new SimpleAnalyzer(),
                              true,
                              IndexWriter.MaxFieldLength.LIMITED);
                      indexWriter.setUseCompoundFile(false);
                      indexDirectory(indexWriter, dataDir, suffix);
                      int numIndexed = indexWriter.maxDoc();
                      indexWriter.optimize();
                      indexWriter.close();
                  
                      Directory.copy(ramDir, FSDirectory.open(indexDir), false); // 3
                  
                      return numIndexed;
                  }
                  

                  這篇關于如何在lucene中將RAMDirectory集成到FSDirectory的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                      <bdo id='gItVN'></bdo><ul id='gItVN'></ul>
                      <tfoot id='gItVN'></tfoot>
                          <tbody id='gItVN'></tbody>
                        • <small id='gItVN'></small><noframes id='gItVN'>

                            <legend id='gItVN'><style id='gItVN'><dir id='gItVN'><q id='gItVN'></q></dir></style></legend>

                            <i id='gItVN'><tr id='gItVN'><dt id='gItVN'><q id='gItVN'><span id='gItVN'><b id='gItVN'><form id='gItVN'><ins id='gItVN'></ins><ul id='gItVN'></ul><sub id='gItVN'></sub></form><legend id='gItVN'></legend><bdo id='gItVN'><pre id='gItVN'><center id='gItVN'></center></pre></bdo></b><th id='gItVN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gItVN'><tfoot id='gItVN'></tfoot><dl id='gItVN'><fieldset id='gItVN'></fieldset></dl></div>
                            主站蜘蛛池模板: 国产精品国产三级国产 | h片在线观看免费 | 欧美一级精品 | 亚洲成人免费网站 | 亚洲成人动漫在线观看 | 黄色一极片 | 国产女人18毛片18精品 | 国产精品欧美精品 | 亚洲一级特黄 | 一级欧美一级日韩 | 成人aaaa| 国产成人精品一区 | 欧美vieox另类极品 | 中日韩毛片 | av少妇| 91小视频在线观看 | 五月激情网站 | 亚洲一区二区免费视频 | 涩五月婷婷 | 91免费黄色 | 午夜影院福利 | 久久av网 | 国产精品一区二区在线免费观看 | 欧美在线视频观看 | 欧美在线中文字幕 | 国产视频福利 | 三级黄色录像片 | 国产精品乱 | 日本欧美在线观看 | 在线免费国产 | 国产精品亚洲综合 | 国产九九九 | 伊人免费视频 | 天天躁日日躁狠狠躁 | 日本香蕉视频 | 性高潮久久久久久久 | 少妇搡bbbb搡bbb搡毛茸茸 | 国产精品一区二区三区免费 | 日韩毛片免费看 | 五月天毛片 | 中文字幕在线观看网址 |