Program: 3221
Project: 3221
Buggy source:
/** 
 * Query DSpace for a list of all items / collections / or communities that match the given search query.
 * @param scope the dspace object parent
 */
public void performSearch(DSpaceObject scope) throws UIException, SearchServiceException {
  if (queryResults != null) {
    return;
  }
  String query=getQuery();
  int page=getParameterPage();
  List<String> filterQueries=new ArrayList<String>();
  String[] fqs=getFilterQueries();
  if (fqs != null) {
    filterQueries.addAll(Arrays.asList(fqs));
  }
  this.queryArgs=new DiscoverQuery();
  DiscoveryConfiguration discoveryConfiguration=SearchUtils.getDiscoveryConfiguration(scope);
  List<String> defaultFilterQueries=discoveryConfiguration.getDefaultFilterQueries();
  queryArgs.addFilterQueries(defaultFilterQueries.toArray(new String[defaultFilterQueries.size()]));
  if (filterQueries.size() > 0) {
    queryArgs.addFilterQueries(filterQueries.toArray(new String[filterQueries.size()]));
  }
  queryArgs.setMaxResults(getParameterRpp());
  String sortBy=ObjectModelHelper.getRequest(objectModel).getParameter("String_Node_Str");
  if (sortBy == null) {
    sortBy="String_Node_Str";
    List<DiscoverySortConfiguration> searchSortFields=discoveryConfiguration.getSearchSortFields();
    for (    DiscoverySortConfiguration sortConfiguration : searchSortFields) {
      if (sortConfiguration.isDefaultSort()) {
        sortBy=SearchUtils.getSearchService().toSortFieldIndex(sortConfiguration.getMetadataField(),sortConfiguration.getType());
      }
    }
  }
  String sortOrder=ObjectModelHelper.getRequest(objectModel).getParameter("String_Node_Str");
  if (sortOrder == null) {
    sortOrder=new DSpace().getConfigurationService().getProperty("String_Node_Str");
  }
  if (sortOrder == null || sortOrder.equals("String_Node_Str")) {
    queryArgs.setSortField(sortBy,DiscoverQuery.SORT_ORDER.desc);
  }
 else {
    queryArgs.setSortField(sortBy,DiscoverQuery.SORT_ORDER.asc);
  }
  String groupBy=ObjectModelHelper.getRequest(objectModel).getParameter("String_Node_Str");
  if (groupBy != null && !groupBy.equalsIgnoreCase("String_Node_Str")) {
    queryArgs.addProperty("String_Node_Str",groupBy);
    queryArgs.addProperty("String_Node_Str","String_Node_Str");
    queryArgs.addProperty("String_Node_Str","String_Node_Str");
    queryArgs.addProperty("String_Node_Str","String_Node_Str");
    queryArgs.setSortField("String_Node_Str",DiscoverQuery.SORT_ORDER.asc);
  }
  queryArgs.setQuery(query != null && !query.trim().equals("String_Node_Str") ? query : null);
  if (page > 1) {
    queryArgs.setStart((page - 1) * queryArgs.getMaxResults());
  }
 else {
    queryArgs.setStart(0);
  }
  this.queryResults=SearchUtils.getSearchService().search(context,scope,queryArgs);
}

Fixed version (ground truth):
/** 
 * Query DSpace for a list of all items / collections / or communities that match the given search query.
 * @param scope the dspace object parent
 */
public void performSearch(DSpaceObject scope) throws UIException, SearchServiceException {
  if (queryResults != null) {
    return;
  }
  String query=getQuery();
  int page=getParameterPage();
  List<String> filterQueries=new ArrayList<String>();
  String[] fqs=getFilterQueries();
  if (fqs != null) {
    filterQueries.addAll(Arrays.asList(fqs));
  }
  this.queryArgs=new DiscoverQuery();
  DiscoveryConfiguration discoveryConfiguration=SearchUtils.getDiscoveryConfiguration(scope);
  List<String> defaultFilterQueries=discoveryConfiguration.getDefaultFilterQueries();
  queryArgs.addFilterQueries(defaultFilterQueries.toArray(new String[defaultFilterQueries.size()]));
  if (filterQueries.size() > 0) {
    queryArgs.addFilterQueries(filterQueries.toArray(new String[filterQueries.size()]));
  }
  queryArgs.setMaxResults(getParameterRpp());
  String sortBy=ObjectModelHelper.getRequest(objectModel).getParameter("String_Node_Str");
  DiscoverySortConfiguration searchSortConfiguration=discoveryConfiguration.getSearchSortConfiguration();
  if (sortBy == null) {
    sortBy="String_Node_Str";
    if (searchSortConfiguration != null) {
      for (      DiscoverySortFieldConfiguration sortFieldConfiguration : searchSortConfiguration.getSortFields()) {
        if (sortFieldConfiguration.equals(searchSortConfiguration.getDefaultSort())) {
          sortBy=SearchUtils.getSearchService().toSortFieldIndex(sortFieldConfiguration.getMetadataField(),sortFieldConfiguration.getType());
        }
      }
    }
  }
  String sortOrder=ObjectModelHelper.getRequest(objectModel).getParameter("String_Node_Str");
  if (sortOrder == null && searchSortConfiguration != null) {
    sortOrder=searchSortConfiguration.getDefaultSortOrder().toString();
  }
  if (sortOrder == null || sortOrder.equalsIgnoreCase("String_Node_Str")) {
    queryArgs.setSortField(sortBy,DiscoverQuery.SORT_ORDER.desc);
  }
 else {
    queryArgs.setSortField(sortBy,DiscoverQuery.SORT_ORDER.asc);
  }
  String groupBy=ObjectModelHelper.getRequest(objectModel).getParameter("String_Node_Str");
  if (groupBy != null && !groupBy.equalsIgnoreCase("String_Node_Str")) {
    queryArgs.addProperty("String_Node_Str",groupBy);
    queryArgs.addProperty("String_Node_Str","String_Node_Str");
    queryArgs.addProperty("String_Node_Str","String_Node_Str");
    queryArgs.addProperty("String_Node_Str","String_Node_Str");
    queryArgs.setSortField("String_Node_Str",DiscoverQuery.SORT_ORDER.asc);
  }
  queryArgs.setQuery(query != null && !query.trim().equals("String_Node_Str") ? query : null);
  if (page > 1) {
    queryArgs.setStart((page - 1) * queryArgs.getMaxResults());
  }
 else {
    queryArgs.setStart(0);
  }
  this.queryResults=SearchUtils.getSearchService().search(context,scope,queryArgs);
}