From f06b15a35a3ea78ba4f25e6593614d50f5a6a99e Mon Sep 17 00:00:00 2001 From: Pavel Yurke Date: Fri, 22 Nov 2013 12:33:40 +0000 Subject: [PATCH] Merged DEV to V4.2-BUG-FIX (4.2.1) 49098 : MNT-7059 : Search description in search result not sensible when using only advanced fields. - Added a method, that get a search value by fields "title", "description", "author" for advanced search in Alfresco Explorer git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/V4.2-BUG-FIX/root@58139 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/bean/search/SearchContext.java | 40 +++++++++++++++++++ source/web/jsp/browse/browse.jsp | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/web/bean/search/SearchContext.java b/source/java/org/alfresco/web/bean/search/SearchContext.java index 53c793202f..fcd5a1ed56 100644 --- a/source/java/org/alfresco/web/bean/search/SearchContext.java +++ b/source/java/org/alfresco/web/bean/search/SearchContext.java @@ -39,6 +39,7 @@ import org.alfresco.service.cmr.repository.Path; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.util.ISO9075; +import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -648,6 +649,45 @@ public class SearchContext implements Serializable this.mode = mode; } + public String getSearchText() + { + if (this.text != null && this.text.trim().length() > 0) + { + return getText(); + } + StringBuilder res = new StringBuilder(); + for (QName attrName : this.queryAttributes.keySet()) + { + if (ContentModel.PROP_TITLE.isMatch(attrName)) + { + res.append(res.length() > 0 ? ", " : ""); + res.append(Application.getMessage(FacesContext.getCurrentInstance(), "title")); + res.append(": "); + res.append(this.queryAttributes.get(attrName)); + } + else if (ContentModel.PROP_DESCRIPTION.isMatch(attrName)) + { + res.append(res.length() > 0 ? ", " : ""); + res.append(Application.getMessage(FacesContext.getCurrentInstance(), "description")); + res.append(": "); + res.append(this.queryAttributes.get(attrName)); + } + else if (ContentModel.PROP_AUTHOR.isMatch(attrName)) + { + res.append(res.length() > 0 ? ", " : ""); + res.append(Application.getMessage(FacesContext.getCurrentInstance(), "author")); + res.append(": "); + res.append(this.queryAttributes.get(attrName)); + } + else + { + res.append(res.length() > 0 ? ", " : ""); + res.append(this.queryAttributes.get(attrName)); + } + } + return res.toString(); + } + /** * @return Returns the search text string. */ diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index c1a7821008..c8f73def6c 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -153,7 +153,7 @@ <%-- Summary --%>
-
+