queryFilter = new ComplementFilter(queryFilter,new GroupAttributeFilter(field,query,fromStem));
queryFilter = new ComplementFilter(queryFilter,getGroupAttributeFilter(field,query,fromStem));
	public List advancedSearch(GrouperSession s,String from,Map attr,List outTerms) throws Exception{		List res = new ArrayList();		String maxCountStr = getSingle("maxFields",attr);		int maxCount = Integer.parseInt(maxCountStr);		String lastQuery = null;		String lastField = null;		String lastAndOrNot = null;		String field;		String query;		String andOrNot;		QueryFilter queryFilter = null;		if(outTerms==null) outTerms=new ArrayList();				Stem fromStem = StemFinder.findByName(s,from);		for (int i=1;i<=maxCount;i++) {			field = getSingle("searchField." + i,attr);			query = getSingle("searchField." + i + ".query",attr);			if(i==1 && (field==null || query==null)) throw new IllegalArgumentException("The first search field and query value must be enetered");			andOrNot = getSingle("searchField." + i + ".searchAndOrNot",attr);			if(query==null || "".equals(query)) query = lastQuery;			if(i>1) {				if(queryFilter==null) {					queryFilter=new GroupAttributeFilter(lastField,lastQuery,fromStem);					outTerms.add(lastQuery);					outTerms.add(lastField);				}				if(field==null && i==2) {					break;				}				if(field==null && i>2) break;								if("and".equals(lastAndOrNot)) {					queryFilter = new IntersectionFilter(queryFilter,new GroupAttributeFilter(field,query,fromStem));				}else if("or".equals(lastAndOrNot)){					queryFilter = new UnionFilter(queryFilter,new GroupAttributeFilter(field,query,fromStem));				}else{					queryFilter = new ComplementFilter(queryFilter,new GroupAttributeFilter(field,query,fromStem));				}				outTerms.add(andOrNot);				outTerms.add(query);				outTerms.add(field);							}			lastQuery = query;			lastField = field;			lastAndOrNot = andOrNot;		}				GrouperQuery q = GrouperQuery.createQuery(s,queryFilter);		res.addAll(q.getGroups());		return res;	}