🐛 IORuntimeException: Path [lucene/index/xxx] is not directory!
This commit is contained in:
parent
d9d9a29bb3
commit
741e7fb4fe
@ -53,7 +53,11 @@ public class PortfolioIndexUtil {
|
|||||||
System.out.println("创建单个索引");
|
System.out.println("创建单个索引");
|
||||||
IndexWriter writer;
|
IndexWriter writer;
|
||||||
try {
|
try {
|
||||||
writer = IndexUtil.getIndexWriter(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH, false);
|
boolean create = true;
|
||||||
|
if (FileUtil.exist(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH)) {
|
||||||
|
create = false;
|
||||||
|
}
|
||||||
|
writer = IndexUtil.getIndexWriter(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH, create);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new StringField("id", t.getIdPortfolio() + "", Field.Store.YES));
|
doc.add(new StringField("id", t.getIdPortfolio() + "", Field.Store.YES));
|
||||||
doc.add(new TextField("title", t.getPortfolioTitle(), Field.Store.YES));
|
doc.add(new TextField("title", t.getPortfolioTitle(), Field.Store.YES));
|
||||||
|
@ -60,7 +60,11 @@ public class UserIndexUtil {
|
|||||||
System.out.println("创建单个索引");
|
System.out.println("创建单个索引");
|
||||||
IndexWriter writer;
|
IndexWriter writer;
|
||||||
try {
|
try {
|
||||||
writer = IndexUtil.getIndexWriter(INDEX_PATH, false);
|
boolean create = true;
|
||||||
|
if (FileUtil.exist(LucenePath.USER_INCREMENT_INDEX_PATH)) {
|
||||||
|
create = false;
|
||||||
|
}
|
||||||
|
writer = IndexUtil.getIndexWriter(INDEX_PATH, create);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new StringField("id", t.getIdUser() + "", Field.Store.YES));
|
doc.add(new StringField("id", t.getIdUser() + "", Field.Store.YES));
|
||||||
doc.add(new TextField("nickname", t.getNickname(), Field.Store.YES));
|
doc.add(new TextField("nickname", t.getNickname(), Field.Store.YES));
|
||||||
|
Loading…
Reference in New Issue
Block a user