Skip to content

Commit efde66c

Browse files
committed
添加文件搜索时间显示
1 parent 5166229 commit efde66c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/com/xwintop/xJavaFxTool/services/littleTools/FileSearchToolService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public FileSearchToolService(FileSearchToolController fileSearchToolController)
102102
}
103103

104104
public void searchContentAction() throws Exception {
105+
long startTime = System.currentTimeMillis();
105106
String queryText = fileSearchToolController.getSearchContentTextField().getText().trim();
106107
String path = fileSearchToolController.getSearchDirectoryTextField().getText().trim();
107108
BooleanQuery.Builder builder = new BooleanQuery.Builder();
@@ -157,7 +158,8 @@ public void searchContentAction() throws Exception {
157158
fileSearchToolController.getSearchResultTableData().add(map);
158159
}
159160
int allCount = indexSearcher.count(new MatchAllDocsQuery());
160-
fileSearchToolController.getSearchTextLabel().setText("总共查询到" + topDocs.totalHits.value + "个文档;当前一共缓存" + allCount + "个文档");
161+
long consumingTime = System.currentTimeMillis() - startTime;
162+
fileSearchToolController.getSearchTextLabel().setText("总共查询到" + topDocs.totalHits.value + "个文档; 当前一共缓存" + allCount + "个文档; 耗时:" + consumingTime + "毫秒");
161163
}
162164

163165
public void refreshIndexAction() throws Exception {

0 commit comments

Comments
 (0)