diff --git a/source/java/org/alfresco/web/bean/SearchContext.java b/source/java/org/alfresco/web/bean/SearchContext.java
index cf5b0855e1..52f8dc4610 100644
--- a/source/java/org/alfresco/web/bean/SearchContext.java
+++ b/source/java/org/alfresco/web/bean/SearchContext.java
@@ -86,6 +86,7 @@ public final class SearchContext implements Serializable
private static final char OP_WILDCARD = '*';
private static final char OP_AND = '+';
private static final char OP_NOT = '-';
+ private static final String STR_OP_WILDCARD = "" + OP_WILDCARD;
/** Search mode constants */
public final static int SEARCH_ALL = 0;
@@ -174,21 +175,7 @@ public final class SearchContext implements Serializable
nameAttrBuf.append(OP_NOT);
}
- // simple single word text search
- if (text.charAt(0) != OP_WILDCARD)
- {
- // escape characters and append the wildcard character
- String safeText = QueryParser.escape(text);
- fullTextBuf.append("TEXT:").append(safeText).append(OP_WILDCARD);
- nameAttrBuf.append("@").append(nameAttr).append(":").append(safeText).append(OP_WILDCARD);
- }
- else
- {
- // found a leading wildcard - prepend it again after escaping the other characters
- String safeText = QueryParser.escape(text.substring(1));
- fullTextBuf.append("TEXT:*").append(safeText).append(OP_WILDCARD);
- nameAttrBuf.append("@").append(nameAttr).append(":*").append(safeText).append(OP_WILDCARD);
- }
+ processSearchTextAttribute(nameAttr, text, nameAttrBuf, fullTextBuf);
}
}
else
@@ -253,18 +240,8 @@ public final class SearchContext implements Serializable
nameAttrBuf.append(OP_AND);
}
- if (term.charAt(0) != OP_WILDCARD)
- {
- String safeTerm = QueryParser.escape(term);
- fullTextBuf.append("TEXT:").append(safeTerm).append(OP_WILDCARD);
- nameAttrBuf.append("@").append(nameAttr).append(":").append(safeTerm).append(OP_WILDCARD);
- }
- else
- {
- String safeTerm = QueryParser.escape(term.substring(1));
- fullTextBuf.append("TEXT:*").append(safeTerm).append(OP_WILDCARD);
- nameAttrBuf.append("@").append(nameAttr).append(":*").append(safeTerm).append(OP_WILDCARD);
- }
+ processSearchTextAttribute(nameAttr, term, nameAttrBuf, fullTextBuf);
+
fullTextBuf.append(' ');
nameAttrBuf.append(' ');
@@ -317,11 +294,9 @@ public final class SearchContext implements Serializable
for (QName qname : queryAttributes.keySet())
{
String value = queryAttributes.get(qname).trim();
- if (value.length() != 0 && value.length() >= minimum)
+ if (value.length() >= minimum)
{
- String escapedName = Repository.escapeQName(qname);
- attributeQuery.append(" +@").append(escapedName)
- .append(":").append(QueryParser.escape(value)).append(OP_WILDCARD);
+ processSearchAttribute(qname, value, attributeQuery);
}
}
@@ -480,6 +455,114 @@ public final class SearchContext implements Serializable
return query;
}
+ /**
+ * Build the lucene search terms required for the specified attribute and append to a buffer.
+ * Supports text values with a wildcard '*' character as the prefix and/or the suffix.
+ *
+ * @param qname QName of the attribute
+ * @param value Non-null value of the attribute
+ * @param buf Buffer to append lucene terms to
+ */
+ private static void processSearchAttribute(QName qname, String value, StringBuilder buf)
+ {
+ if (value.indexOf(' ') == -1)
+ {
+ String safeValue;
+ String prefix = "";
+ String suffix = "";
+
+ // look for a wildcard suffix
+ if (value.charAt(value.length() - 1) != OP_WILDCARD)
+ {
+ // look for wildcard prefix
+ if (value.charAt(0) != OP_WILDCARD)
+ {
+ safeValue = QueryParser.escape(value);
+ }
+ else
+ {
+ safeValue = QueryParser.escape(value.substring(1));
+ prefix = STR_OP_WILDCARD;
+ }
+ }
+ else
+ {
+ // found a wildcard suffix - append it again after escaping the other characters
+ suffix = STR_OP_WILDCARD;
+
+ // look for wildcard prefix
+ if (value.charAt(0) != OP_WILDCARD)
+ {
+ safeValue = QueryParser.escape(value.substring(0, value.length() - 1));
+ }
+ else
+ {
+ safeValue = QueryParser.escape(value.substring(1, value.length() - 1));
+ prefix = STR_OP_WILDCARD;
+ }
+ }
+
+ buf.append(" +@").append(Repository.escapeQName(qname)).append(":")
+ .append(prefix).append(safeValue).append(suffix);
+ }
+ else
+ {
+ // phrase multi-word search
+ String safeValue = QueryParser.escape(value);
+ buf.append(" +@").append(Repository.escapeQName(qname)).append(":\"").append(safeValue).append('"');
+ }
+ }
+
+ /**
+ * Build the lucene search terms required for the specified attribute and append to multiple buffers.
+ * Supports text values with a wildcard '*' character as the prefix and/or the suffix.
+ *
+ * @param qname QName.toString() of the attribute
+ * @param value Non-null value of the attribute
+ * @param attrBuf Attribute search buffer to append lucene terms to
+ * @param textBuf Text search buffer to append lucene terms to
+ */
+ private static void processSearchTextAttribute(String qname, String value, StringBuilder attrBuf, StringBuilder textBuf)
+ {
+ String safeValue;
+ String suffix = "";
+ String prefix = "";
+
+ if (value.charAt(value.length() - 1) != OP_WILDCARD)
+ {
+ // look for wildcard prefix
+ if (value.charAt(0) != OP_WILDCARD)
+ {
+ safeValue = QueryParser.escape(value);
+ }
+ else
+ {
+ // found a leading wildcard - prepend it again after escaping the other characters
+ prefix = STR_OP_WILDCARD;
+ safeValue = QueryParser.escape(value.substring(1));
+ }
+ }
+ else
+ {
+ suffix = STR_OP_WILDCARD;
+
+ // look for wildcard prefix
+ if (value.charAt(0) != OP_WILDCARD)
+ {
+ safeValue = QueryParser.escape(value.substring(0, value.length() - 1));
+ }
+ else
+ {
+ prefix = STR_OP_WILDCARD;
+ safeValue = QueryParser.escape(value.substring(1, value.length() - 1));
+ }
+ }
+
+ textBuf.append("TEXT:").append(prefix).append(safeValue).append(suffix);
+ attrBuf.append("@").append(qname).append(":")
+ .append(prefix).append(safeValue).append(suffix);
+ }
+
/**
* Generate a search XPATH pointing to the specified node, optionally return an XPATH
* that includes the child nodes.
diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java
index e90aa78e15..eca548a8ed 100644
--- a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java
+++ b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java
@@ -8,7 +8,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.workflow.WorkflowModel;
-import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.cmr.workflow.WorkflowTask;
@@ -185,15 +184,6 @@ public class WorkflowBean
node.getProperties().put("type", taskDef.metadata.getTitle());
node.getProperties().put("id", task.id);
- // add the name of the source space (if there is one)
- NodeRef context = (NodeRef)task.properties.get(WorkflowModel.PROP_CONTEXT);
- if (context != null && this.nodeService.exists(context))
- {
- String name = Repository.getNameForNode(this.nodeService, context);
- node.getProperties().put("sourceSpaceName", name);
- node.getProperties().put("sourceSpaceId", context.getId());
- }
-
// add extra properties for completed tasks
if (task.state.equals(WorkflowTaskState.COMPLETED))
{
diff --git a/source/web/jsp/workflow/tasks-completed-dashlet.jsp b/source/web/jsp/workflow/tasks-completed-dashlet.jsp
index 87b422232c..49245d5c8e 100644
--- a/source/web/jsp/workflow/tasks-completed-dashlet.jsp
+++ b/source/web/jsp/workflow/tasks-completed-dashlet.jsp
@@ -43,52 +43,41 @@
-
- <%-- Source column --%>
-
-
-
-
-
-
-
-
<%-- Created Date column --%>
-
+
-
+
-
+
<%-- Completed date column --%>
-
+
-
+
-
+
<%-- Outcome column --%>
-
+
-
+
-
+
<%-- Actions column --%>
-
+
-
+
-
diff --git a/source/web/jsp/workflow/tasks-todo-dashlet.jsp b/source/web/jsp/workflow/tasks-todo-dashlet.jsp
index be2f84d44c..a225ec347e 100644
--- a/source/web/jsp/workflow/tasks-todo-dashlet.jsp
+++ b/source/web/jsp/workflow/tasks-todo-dashlet.jsp
@@ -44,59 +44,48 @@
- <%-- Source column --%>
+ <%-- Created Date column --%>
-
+
-
-
-
-
-
- <%-- Created Date column --%>
-
-
-
-
-
+
<%-- Due date column --%>
-
+
-
+
-
+
<%-- Status column --%>
-
+
-
+
-
+
<%-- Priority column --%>
-
+
-
+
-
+
<%-- Actions column --%>
-
+
-
+
-