protected void setUp() throws IOException { String contents1Doc1 = "word1 word2 word3 word32 word1 word45 word56 word67 word67 word2 word67 word88 word99 word99 word33"; String contents2Doc1 = "word1 word2 word3 word32 word1 word45 word56 word67"; String contents1Doc2 = "word2 word3 word4 word55 word96 word2 word54 word33 wordss"; String contents2Doc2 = "word2 word3 word4 word55"; String contents1Doc3 = "word1 word100 word400 word555 word966 word544 word333 wordss"; String contents2Doc3 = "word1 word100"; LgteIndexWriter writer = new LgteIndexWriter(pathUnique, true, Model.OkapiBM25Model); LgteDocumentWrapper doc1 = new LgteDocumentWrapper(); doc1.indexText(Globals.DOCUMENT_ID_FIELD, "1"); doc1.indexText("contents1", contents1Doc1); doc1.indexText("contents2", contents2Doc1); LgteDocumentWrapper doc2 = new LgteDocumentWrapper(); doc2.indexText(Globals.DOCUMENT_ID_FIELD, "2"); doc2.indexText("contents1", contents1Doc2); doc2.indexText("contents2", contents2Doc2); LgteDocumentWrapper doc3 = new LgteDocumentWrapper(); doc3.indexText(Globals.DOCUMENT_ID_FIELD, "3"); doc3.indexText("contents1", contents1Doc3); doc3.indexText("contents2", contents2Doc3); writer.addDocument(doc1); writer.addDocument(doc2); writer.addDocument(doc3); writer.close(); // these two writers will replace the previous one // The first one will index contents1 and the second will index the contents2 writer = new LgteIndexWriter(pathMulti1, true); doc1 = new LgteDocumentWrapper(); doc1.indexText(Globals.DOCUMENT_ID_FIELD, "1"); doc1.indexText("contents1", contents1Doc1); doc2 = new LgteDocumentWrapper(); doc2.indexText(Globals.DOCUMENT_ID_FIELD, "2"); doc2.indexText("contents1", contents1Doc2); doc3 = new LgteDocumentWrapper(); doc3.indexText(Globals.DOCUMENT_ID_FIELD, "3"); doc3.indexText("contents1", contents1Doc3); writer.addDocument(doc1); writer.addDocument(doc2); writer.addDocument(doc3); writer.close(); writer = new LgteIndexWriter(pathMulti2, true); doc1 = new LgteDocumentWrapper(); doc1.indexText(Globals.DOCUMENT_ID_FIELD, "1"); doc1.indexText("contents2", contents2Doc1); doc2 = new LgteDocumentWrapper(); doc2.indexText(Globals.DOCUMENT_ID_FIELD, "2"); doc2.indexText("contents2", contents2Doc2); doc3 = new LgteDocumentWrapper(); doc3.indexText(Globals.DOCUMENT_ID_FIELD, "3"); doc3.indexText("contents2", contents2Doc3); writer.addDocument(doc1); writer.addDocument(doc2); writer.addDocument(doc3); writer.close(); }