diff --git a/source/java/org/alfresco/web/bean/AdvancedSearchBean.java b/source/java/org/alfresco/web/bean/AdvancedSearchBean.java index 3f90e14004..1d6c574d5e 100644 --- a/source/java/org/alfresco/web/bean/AdvancedSearchBean.java +++ b/source/java/org/alfresco/web/bean/AdvancedSearchBean.java @@ -23,8 +23,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.faces.component.UISelectBoolean; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; +import javax.faces.model.DataModel; +import javax.faces.model.ListDataModel; import javax.faces.model.SelectItem; import org.alfresco.config.ConfigService; @@ -42,12 +45,15 @@ import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.util.CachingDateFormat; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.MapNode; +import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.config.ClientConfigElement.CustomProperty; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; +import org.alfresco.web.ui.repo.component.UICategorySelector; import org.alfresco.web.ui.repo.component.UISearchCustomProperties; /** @@ -181,19 +187,20 @@ public class AdvancedSearchBean } /** - * @return Returns the category. + * Returns the properties for current categories JSF DataModel + * + * @return JSF DataModel representing the current categories to search against */ - public NodeRef getCategory() + public DataModel getCategoriesDataModel() { - return this.category; - } - - /** - * @param category The category to set. - */ - public void setCategory(NodeRef category) - { - this.category = category; + if (this.categoriesDataModel == null) + { + this.categoriesDataModel = new ListDataModel(); + } + + this.categoriesDataModel.setWrappedData(this.categories); + + return this.categoriesDataModel; } /** @@ -212,22 +219,6 @@ public class AdvancedSearchBean this.locationChildren = locationChildren; } - /** - * @return Returns true to search category children, false for just the specified category. - */ - public boolean getCategoryChildren() - { - return this.categoryChildren; - } - - /** - * @param categoryChildren True to search category children, false for just the specified category. - */ - public void setCategoryChildren(boolean categoryChildren) - { - this.categoryChildren = categoryChildren; - } - /** * @return Returns the createdDateFrom. */ @@ -511,7 +502,8 @@ public class AdvancedSearchBean this.lookin = LOOKIN_ALL; this.contentType = null; this.location = null; - this.category = null; + this.locationChildren = false; + this.categories = new ArrayList(2); this.title = null; this.description = null; this.author = null; @@ -650,10 +642,16 @@ public class AdvancedSearchBean } // category path search - if (this.category != null) + if (this.categories.size() != 0) { - search.setCategories(new String[]{SearchContext.getPathFromSpaceRef( - new NodeRef(Repository.getStoreRef(), this.category.getId()), this.categoryChildren)}); + String[] paths = new String[this.categories.size()]; + for (int i=0; i categories = new ArrayList(2); + + /** datamodel for table of categories to search */ + private DataModel categoriesDataModel = null; /** title attribute to search */ private String title = null; @@ -818,9 +854,6 @@ public class AdvancedSearchBean /** true to search location children as well as location */ private boolean locationChildren = true; - /** true to search category children as well as category */ - private boolean categoryChildren = true; - /** author (creator) attribute to search */ private String author = null; diff --git a/source/java/org/alfresco/web/bean/SearchContext.java b/source/java/org/alfresco/web/bean/SearchContext.java index d111f24901..c9b1a9dea9 100644 --- a/source/java/org/alfresco/web/bean/SearchContext.java +++ b/source/java/org/alfresco/web/bean/SearchContext.java @@ -295,10 +295,10 @@ public final class SearchContext implements Serializable query = attributeQuery + " AND (" + query + ')'; } - // match entire query against specified Space path + // match entire query against any specified paths if (pathQuery != null) { - query = pathQuery + " AND (" + query + ')'; + query = "(" + pathQuery + ") AND (" + query + ')'; } if (logger.isDebugEnabled()) @@ -308,7 +308,7 @@ public final class SearchContext implements Serializable } /** - * Generate a search XPATH pointing to the specified node Id, optionally return an XPATH + * Generate a search XPATH pointing to the specified node, optionally return an XPATH * that includes the child nodes. * * @param id Of the node to generate path too @@ -364,7 +364,7 @@ public final class SearchContext implements Serializable } /** - * @param categories The categories to set. + * @param categories The categories to set as a list of search XPATHs */ public void setCategories(String[] categories) { diff --git a/source/web/jsp/dialog/advanced-search.jsp b/source/web/jsp/dialog/advanced-search.jsp index 255f264ccf..231f85d2e0 100644 --- a/source/web/jsp/dialog/advanced-search.jsp +++ b/source/web/jsp/dialog/advanced-search.jsp @@ -189,15 +189,59 @@ + + + + + +
- +
- +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+