File tree Expand file tree Collapse file tree
src/main/java/com/xwintop/xJavaFxTool/services/littleTools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -167,17 +167,16 @@ public void addSearchIndexFile(Path path) {
167167 Iterator <Path > pathIterator = stream .iterator ();
168168 while (pathIterator .hasNext ()) {
169169 Path curPath = pathIterator .next ();
170- ThreadUtil .execute (() -> {
171- try {
172- addIndexDocument (curPath .toFile ());
173- if (Files .isDirectory (curPath )) {
174- addSearchIndexFile (curPath );
175- }
176- } catch (Exception e ) {
177- log .warn ("添加索引失败:" , e );
170+ try {
171+ addIndexDocument (curPath .toFile ());
172+ if (Files .isDirectory (curPath )) {
173+ addSearchIndexFile (curPath );
178174 }
179- });
175+ } catch (Exception e ) {
176+ log .warn ("添加索引失败:" , e );
177+ }
180178 }
179+ indexWriter .commit ();
181180 } catch (Exception e ) {
182181 log .warn ("获取失败:" , e );
183182 }
@@ -197,7 +196,7 @@ public void addIndexDocument(File file) throws Exception {
197196 doc .add (new StringField ("isDirectory" , String .valueOf (file .isDirectory ()), Field .Store .NO ));
198197 indexWriter .updateDocument (new Term ("absolutePath" , file .getAbsolutePath ()), doc );
199198// indexWriter.addDocument(doc);
200- indexWriter .commit ();
199+ // indexWriter.commit();
201200 }
202201
203202 public void autoRefreshIndexAction () {
You can’t perform that action at this time.
0 commit comments