Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テキストファイルのインデックスを作成し、RAMDirectoryを使用して高速インデックスを作成しようとしていますが、重複を防ぐために以前のRAMDirectoryをクリアする方法があるかどうか疑問に思っていましたか?
「前のRAMDirectoryをクリアする」とはどういう意味かわかりませんが、createフラグをtrueに文字列化することで、RAMDirの前のインデックスを上書きできます。これにより、コンストラクター呼び出しの場所に新しいインデックスが作成されます。
IndexWriter(Directory d, Analyzer a, boolean create, IndexWriter.MaxFieldLength mfl)
dのインデックスのIndexWriterを作成します。