Browse Source

REPORT-10954&REPORT-10928

“模板内容”这一项不要支持分词搜索;
需分词的场景下,先搜索不分词的结果集,以获取匹配度最高的结果集。
research/10.0
alex.sung 6 years ago
parent
commit
c8705329e1
  1. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  3. 1
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java

12
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -490,11 +490,11 @@ public class AlphaFineDialog extends UIDialog {
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { } else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) {
buildDocumentList(new String[]{getStoreText(searchText)}); buildDocumentList(new String[]{getStoreText(searchText)});
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { } else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) {
buildFileList(new String[]{getStoreText(searchText)}); buildFileList(getStoreText(searchText), new String[]{getStoreText(searchText)});
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { } else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
buildFileList(new String[]{searchText}); buildFileList(getStoreText(searchText), new String[]{searchText});
} else if (searchText.startsWith(DS_MARK)) { } else if (searchText.startsWith(DS_MARK)) {
buildFileList(new String[]{DS_NAME + getStoreText(searchText)}); buildFileList(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)});
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { } else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) {
buildPluginList(new String[]{getStoreText(searchText)}); buildPluginList(new String[]{getStoreText(searchText)});
} else if (searchText.startsWith(SIMILAR_MARK)) { } else if (searchText.startsWith(SIMILAR_MARK)) {
@ -535,7 +535,7 @@ public class AlphaFineDialog extends UIDialog {
buildRecentList(segmentationResult); buildRecentList(segmentationResult);
buildRecommendList(segmentationResult); buildRecommendList(segmentationResult);
buildActionList(segmentationResult); buildActionList(segmentationResult);
buildFileList(segmentationResult); buildFileList(searchText, segmentationResult);
buildDocumentList(segmentationResult); buildDocumentList(segmentationResult);
buildPluginList(segmentationResult); buildPluginList(segmentationResult);
buildSimilarList(segmentationResult); buildSimilarList(segmentationResult);
@ -547,8 +547,8 @@ public class AlphaFineDialog extends UIDialog {
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText));
} }
private void buildFileList(final String[] searchText) { private void buildFileList(String searchStr, final String[] searchText) {
addSearchResult(FileSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(FileSearchManager.getInstance().getLessSearchResult(searchStr, searchText));
} }
private void buildActionList(final String[] searchText) { private void buildActionList(final String[] searchText) {

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

@ -62,7 +62,8 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return new FileModel(name, filePath, searchCount); return new FileModel(name, filePath, searchCount);
} }
public SearchResult getLessSearchResult(String[] searchText) {
public SearchResult getLessSearchResult(String searchStr, String[] searchText) {
this.filterModelList = new SearchResult(); this.filterModelList = new SearchResult();
this.lessModelList = new SearchResult(); this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult(); this.moreModelList = new SearchResult();
@ -78,6 +79,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
isContainFrm = true; isContainFrm = true;
doSearch(this.searchText); doSearch(this.searchText);
} }
doFileContentSearch(searchStr);
if (filterModelList.isEmpty()) { if (filterModelList.isEmpty()) {
return new SearchResult(); return new SearchResult();
@ -93,6 +95,11 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return lessModelList; return lessModelList;
} }
@Override
public SearchResult getLessSearchResult(String[] searchText) {
return null;
}
@Override @Override
public SearchResult getMoreSearchResult(String searchText) { public SearchResult getMoreSearchResult(String searchText) {
return moreModelList; return moreModelList;
@ -111,6 +118,13 @@ public class FileSearchManager implements AlphaFineSearchProvider {
} }
} }
}
/**
* 搜索模板内容
* @param searchText
*/
private void doFileContentSearch(String searchText) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) {
FileNode[] fileNodes = FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); FileNode[] fileNodes = FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true);
for (FileNode node : fileNodes) { for (FileNode node : fileNodes) {

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

@ -66,6 +66,7 @@ public class SegmentationManager {
return new String[]{searchText}; return new String[]{searchText};
} }
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
result.add(searchText);
BreakIterator itor = BreakIterator.getWordInstance(); BreakIterator itor = BreakIterator.getWordInstance();
itor.setText(searchText); itor.setText(searchText);
int start = itor.first(); int start = itor.first();

Loading…
Cancel
Save