Browse Source

REPORT-70681 搜索结果高亮和搜索结果准确性

newui
hades 3 years ago
parent
commit
b00644e34e
  1. 24
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  2. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java
  3. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java
  4. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  5. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  6. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  7. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  8. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

24
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java

@ -171,38 +171,26 @@ public class AlphaFineFrame extends JFrame {
this.settingSearchWorkerManager = new SearchWorkerManager(
CellType.ACTION,
searchTextBean -> {
ActionSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation());
return ActionSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> ActionSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new SimpleRightSearchResultPane(new NoResultPane(NO_RESULT, AlphaFineConstants.NO_RESULT_ICON))
);
fileSearchWorkerManager = new SearchWorkerManager(
CellType.FILE,
searchTextBean -> {
FileSearchManager.getInstance().getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation());
return FileSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> FileSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new LoadingRightSearchResultPane()
);
documentWorkerManager = new SearchWorkerManager(
CellType.DOCUMENT,
searchTextBean -> {
DocumentSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation());
return DocumentSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> DocumentSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new SimpleRightSearchResultPane(new JPanel())
);
pluginSearchWorkerManager = new SearchWorkerManager(
CellType.PLUGIN,
searchTextBean -> {
PluginSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation());
return PluginSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> PluginSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new LoadingRightSearchResultPane()
);
@ -663,6 +651,10 @@ public class AlphaFineFrame extends JFrame {
resultPane.add(panel, flag);
}
public void removeSearchResultPane(JPanel panel) {
resultPane.remove(panel);
}
private void doSearch(String text) {

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java

@ -48,10 +48,11 @@ public class ProductNewsSearchWorkerManager implements SearchManager {
checkSearchWork();
searchOver = false;
networkError = false;
if (searchResultPane == null) {
if (searchResultPane != null) {
alphaFineFrame.removeSearchResultPane(searchResultPane);
}
searchResultPane = new ProductNewsSearchResultPane(searchTextBean.getSegmentation());
alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result());
}
this.searchWorker = new SwingWorker<DefaultListModel<ProductNews>, Void>() {
@Override

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java

@ -48,10 +48,11 @@ public class SearchWorkerManager implements SearchManager {
}
private void initSearchResult(SearchTextBean searchTextBean) {
if (searchResultPane == null) {
if (searchResultPane != null) {
alphaFineFrame.removeSearchResultPane(searchResultPane);
}
searchResultPane = new SearchResultPane(searchTextBean.getSegmentation(), resultShowPane);
alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result());
}
}

12
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.fun;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
/**
* Created by XiaXiang on 2017/3/27.
@ -20,4 +21,15 @@ public interface AlphaFineSearchProvider {
* @return
*/
SearchResult getMoreSearchResult(String searchText);
/**
* 获取所有搜索结果 取决于具体实现
*
* @param searchTextBean
* @return
*/
default SearchResult getSearchResult(SearchTextBean searchTextBean) {
return new SearchResult();
}
}

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel;
@ -101,4 +102,10 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
public SearchResult getMoreSearchResult(String searchText) {
return moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSegmentation());
return filterModelList;
}
}

12
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

@ -7,15 +7,14 @@ import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import java.io.IOException;
/**
* Created by XiaXiang on 2017/3/27.
@ -24,6 +23,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
private static volatile DocumentSearchManager instance;
private SearchResult lessModelList;
private SearchResult moreModelList;
private SearchResult searchResult;
public static DocumentSearchManager getInstance() {
if (instance == null) {
@ -54,6 +54,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
public SearchResult getLessSearchResult(String[] searchText) {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
searchResult = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
@ -63,7 +64,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
if(noConnectList != null){
return noConnectList;
}
SearchResult searchResult = new SearchResult();
searchResult = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText[j];
try {
@ -106,4 +107,9 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
return moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSegmentation());
return searchResult;
}
}

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -9,16 +9,19 @@ import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.FileModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import java.util.Arrays;
/**
@ -71,6 +74,8 @@ public class FileSearchManager implements AlphaFineSearchProvider {
this.filterModelList = new SearchResult();
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
FineLoggerFactory.getLogger().error("===={}====", searchStr);
FineLoggerFactory.getLogger().error("分词 ==={}===", Arrays.toString(searchText));
for (int j = 0; j < searchText.length; j++) {
this.searchText = dealWithSearchText(searchText[j]);
if (StringUtils.isBlank(this.searchText) || ComparatorUtils.equals(this.searchText, DS_NAME)) {
@ -114,6 +119,12 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation());
return filterModelList;
}
private void doSearch(String searchText) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) {
for (FileNode node : fileNodes) {

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -7,6 +7,7 @@ import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpToolbox;
@ -28,6 +29,7 @@ import java.net.URLEncoder;
public class PluginSearchManager implements AlphaFineSearchProvider {
private SearchResult lessModelList;
private SearchResult moreModelList;
private SearchResult searchResult;
private PluginSearchManager() {
@ -97,7 +99,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
public SearchResult getLessSearchResult(String[] searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
SearchResult searchResult = new SearchResult();
this.searchResult = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
@ -146,4 +148,11 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
public SearchResult getMoreSearchResult(String searchText) {
return this.moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSegmentation());
return searchResult;
}
}

Loading…
Cancel
Save