Program: 34815
Project: 34815
Buggy source:
public Query constructQuery(final Field field,final IndexerField indexerField,final String query,final SearchType type) throws ParseException {
  if (indexerField == null) {
    getLogger().warn("String_Node_Str" + field.toString() + "String_Node_Str");
    return null;
  }
  if (!indexerField.isIndexed()) {
    getLogger().warn("String_Node_Str" + field.toString() + "String_Node_Str");
    return null;
  }
  if (Field.NOT_PRESENT.equals(query)) {
    return new WildcardQuery(new Term(indexerField.getKey(),"String_Node_Str"));
  }
  if (SearchType.EXACT.equals(type)) {
    if (indexerField.isKeyword()) {
      if (query.contains("String_Node_Str") || query.contains("String_Node_Str")) {
        return new WildcardQuery(new Term(indexerField.getKey(),query));
      }
 else {
        return new TermQuery(new Term(indexerField.getKey(),query));
      }
    }
 else     if (!indexerField.isKeyword() && indexerField.isStored()) {
      if (JarFileContentsIndexCreator.FLD_CLASSNAMES_KW.equals(indexerField)) {
        if (query.startsWith("String_Node_Str")) {
          return new TermQuery(new Term(indexerField.getKey(),query.toLowerCase().replaceAll("String_Node_Str","String_Node_Str")));
        }
 else {
          return new TermQuery(new Term(indexerField.getKey(),"String_Node_Str" + query.toLowerCase().replaceAll("String_Node_Str","String_Node_Str")));
        }
      }
 else {
        getLogger().warn(type.toString() + "String_Node_Str" + indexerField.getOntology().toString()+ "String_Node_Str");
        return null;
      }
    }
 else {
      getLogger().warn(type.toString() + "String_Node_Str" + indexerField.getOntology().toString()+ "String_Node_Str");
      return null;
    }
  }
 else   if (SearchType.SCORED.equals(type)) {
    if (JarFileContentsIndexCreator.FLD_CLASSNAMES.equals(indexerField)) {
      String qpQuery=query.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
      QueryParser qp=new QueryParser(indexerField.getKey(),new NexusAnalyzer());
      qp.setDefaultOperator(Operator.AND);
      return qp.parse(qpQuery);
    }
 else     if (indexerField.isKeyword()) {
      if (query.contains("String_Node_Str") || query.contains("String_Node_Str")) {
        return new WildcardQuery(new Term(indexerField.getKey(),query));
      }
 else {
        BooleanQuery bq=new BooleanQuery();
        Term t=new Term(indexerField.getKey(),query);
        bq.add(new TermQuery(t),Occur.SHOULD);
        PrefixQuery pq=new PrefixQuery(t);
        pq.setBoost(0.8f);
        bq.add(pq,Occur.SHOULD);
        return bq;
      }
    }
 else {
      String qpQuery=query;
      QueryParser qp=new QueryParser(indexerField.getKey(),new NexusAnalyzer());
      qp.setDefaultOperator(Operator.AND);
      if (qpQuery.matches("String_Node_Str")) {
        qpQuery=qpQuery.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
      }
      if (!qpQuery.endsWith("String_Node_Str") && !qpQuery.endsWith("String_Node_Str")) {
        qpQuery+="String_Node_Str";
      }
      try {
        BooleanQuery q1=new BooleanQuery();
        q1.add(qp.parse(qpQuery),Occur.SHOULD);
        if (qpQuery.contains("String_Node_Str")) {
          q1.add(qp.parse("String_Node_Str" + qpQuery + "String_Node_Str"),Occur.SHOULD);
        }
        Query q2=null;
        int termCount=countTerms(indexerField,query);
        if (!query.contains("String_Node_Str") && termCount > 1) {
          IndexerField keywordField=selectIndexerField(indexerField.getOntology(),SearchType.EXACT);
          if (keywordField.isKeyword()) {
            q2=constructQuery(indexerField.getOntology(),keywordField,query,type);
          }
        }
        if (q2 == null) {
          return q1;
        }
 else {
          BooleanQuery bq=new BooleanQuery();
          bq.add(q2,Occur.SHOULD);
          bq.add(q1,Occur.SHOULD);
          return bq;
        }
      }
 catch (      ParseException e) {
        throw e;
      }
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Query constructQuery(final Field field,final IndexerField indexerField,final String query,final SearchType type) throws ParseException {
  if (indexerField == null) {
    getLogger().warn("String_Node_Str" + field.toString() + "String_Node_Str"+ "String_Node_Str");
    return null;
  }
  if (!indexerField.isIndexed()) {
    getLogger().warn("String_Node_Str" + field.toString() + "String_Node_Str");
    return null;
  }
  if (Field.NOT_PRESENT.equals(query)) {
    return new WildcardQuery(new Term(indexerField.getKey(),"String_Node_Str"));
  }
  if (SearchType.EXACT.equals(type)) {
    if (indexerField.isKeyword()) {
      if (query.contains("String_Node_Str") || query.contains("String_Node_Str")) {
        return new WildcardQuery(new Term(indexerField.getKey(),query));
      }
 else {
        return new TermQuery(new Term(indexerField.getKey(),query));
      }
    }
 else     if (!indexerField.isKeyword() && indexerField.isStored()) {
      if (JarFileContentsIndexCreator.FLD_CLASSNAMES_KW.equals(indexerField)) {
        if (query.startsWith("String_Node_Str")) {
          return new TermQuery(new Term(indexerField.getKey(),query.toLowerCase().replaceAll("String_Node_Str","String_Node_Str")));
        }
 else {
          return new TermQuery(new Term(indexerField.getKey(),"String_Node_Str" + query.toLowerCase().replaceAll("String_Node_Str","String_Node_Str")));
        }
      }
 else {
        getLogger().warn(type.toString() + "String_Node_Str" + indexerField.getOntology().toString()+ "String_Node_Str"+ "String_Node_Str");
        return null;
      }
    }
 else {
      getLogger().warn(type.toString() + "String_Node_Str" + indexerField.getOntology().toString()+ "String_Node_Str"+ "String_Node_Str");
      return null;
    }
  }
 else   if (SearchType.SCORED.equals(type)) {
    if (JarFileContentsIndexCreator.FLD_CLASSNAMES.equals(indexerField)) {
      String qpQuery=query.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
      QueryParser qp=new QueryParser(indexerField.getKey(),new NexusAnalyzer());
      qp.setDefaultOperator(Operator.AND);
      return qp.parse(qpQuery);
    }
 else     if (indexerField.isKeyword()) {
      if (query.contains("String_Node_Str") || query.contains("String_Node_Str")) {
        return new WildcardQuery(new Term(indexerField.getKey(),query));
      }
 else {
        BooleanQuery bq=new BooleanQuery();
        Term t=new Term(indexerField.getKey(),query);
        bq.add(new TermQuery(t),Occur.SHOULD);
        PrefixQuery pq=new PrefixQuery(t);
        pq.setBoost(0.8f);
        bq.add(pq,Occur.SHOULD);
        return bq;
      }
    }
 else {
      String qpQuery=query;
      QueryParser qp=new QueryParser(indexerField.getKey(),new NexusAnalyzer());
      qp.setDefaultOperator(Operator.AND);
      if (qpQuery.matches("String_Node_Str")) {
        qpQuery=qpQuery.toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
      }
      if (!qpQuery.endsWith("String_Node_Str") && !qpQuery.endsWith("String_Node_Str")) {
        qpQuery+="String_Node_Str";
      }
      try {
        BooleanQuery q1=new BooleanQuery();
        q1.add(qp.parse(qpQuery),Occur.SHOULD);
        if (qpQuery.contains("String_Node_Str")) {
          q1.add(qp.parse("String_Node_Str" + qpQuery + "String_Node_Str"),Occur.SHOULD);
        }
        Query q2=null;
        int termCount=countTerms(indexerField,query);
        if (!query.contains("String_Node_Str") && termCount > 1) {
          IndexerField keywordField=selectIndexerField(indexerField.getOntology(),SearchType.EXACT);
          if (keywordField.isKeyword()) {
            q2=constructQuery(indexerField.getOntology(),keywordField,query,type);
          }
        }
        if (q2 == null) {
          return q1;
        }
 else {
          BooleanQuery bq=new BooleanQuery();
          bq.add(q2,Occur.SHOULD);
          bq.add(q1,Occur.SHOULD);
          return bq;
        }
      }
 catch (      ParseException e) {
        throw e;
      }
    }
  }
 else {
    return null;
  }
}