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
This commit is contained in:
Pavel Yurke
2013-11-22 12:33:40 +00:00
parent e9ce4b2464
commit f06b15a35a
2 changed files with 41 additions and 1 deletions

View File

@@ -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.
*/