Program: 142252
Project: 142252
Buggy source:
private void search(){
  Locale currentLocale=Locale.getDefault();
  long startTime=System.currentTimeMillis();
  SQLiteDatabase db=CommCareApplication._().getUserDbHandle();
  db.beginTransaction();
  full:   for (int index=0; index < full.size(); ++index) {
    if (index % 500 == 0) {
      db.yieldIfContendedSafely();
    }
    Entity<TreeReference> e=full.get(index);
    if (cancelled) {
      break;
    }
    if ("String_Node_Str".equals(filterRaw)) {
      matchList.add(e);
      continue;
    }
    boolean add=false;
    int score=0;
    filter:     for (    String filter : searchTerms) {
      add=false;
      for (int i=0; i < e.getNumFields(); ++i) {
        String field=e.getNormalizedField(i);
        if (field != "String_Node_Str" && field.toLowerCase(currentLocale).contains(filter)) {
          add=true;
          continue filter;
        }
 else {
          if (mFuzzySearchEnabled) {
            for (            String fieldChunk : e.getSortFieldPieces(i)) {
              Pair<Boolean,Integer> match=StringUtils.fuzzyMatch(fieldChunk,filter);
              if (match.first) {
                add=true;
                score+=match.second;
                continue filter;
              }
            }
          }
        }
      }
      if (!add) {
        break;
      }
    }
    if (add) {
      matchScores.add(Pair.create(index,score));
      continue full;
    }
  }
  if (mAsyncMode) {
    Collections.sort(matchScores,new Comparator<Pair<Integer,Integer>>(){
      @Override public int compare(      Pair<Integer,Integer> lhs,      Pair<Integer,Integer> rhs){
        return lhs.second - rhs.second;
      }
    }
);
  }
  for (  Pair<Integer,Integer> match : matchScores) {
    matchList.add(full.get(match.first));
  }
  db.setTransactionSuccessful();
  db.endTransaction();
  if (cancelled) {
    return;
  }
  long time=System.currentTimeMillis() - startTime;
  if (time > 1000) {
    Logger.log("String_Node_Str","String_Node_Str" + time + "String_Node_Str");
  }
  context.runOnUiThread(new Runnable(){
    @Override public void run(){
      current=matchList;
      if (actionEnabled) {
        actionPosition=current.size();
      }
      currentSearchTerms=searchTerms;
      update();
    }
  }
);
}

Fixed version (ground truth):
private void search(){
  Locale currentLocale=Locale.getDefault();
  long startTime=System.currentTimeMillis();
  SQLiteDatabase db=CommCareApplication._().getUserDbHandle();
  db.beginTransaction();
  full:   for (int index=0; index < full.size(); ++index) {
    if (index % 500 == 0) {
      db.yieldIfContendedSafely();
    }
    Entity<TreeReference> e=full.get(index);
    if (cancelled) {
      break;
    }
    if ("String_Node_Str".equals(filterRaw)) {
      matchList.add(e);
      continue;
    }
    boolean add=false;
    int score=0;
    filter:     for (    String filter : searchTerms) {
      add=false;
      for (int i=0; i < e.getNumFields(); ++i) {
        String field=e.getNormalizedField(i);
        if (field != "String_Node_Str" && field.toLowerCase(currentLocale).contains(filter)) {
          add=true;
          continue filter;
        }
 else {
          if (mFuzzySearchEnabled) {
            for (            String fieldChunk : e.getSortFieldPieces(i)) {
              Pair<Boolean,Integer> match=StringUtils.fuzzyMatch(fieldChunk,filter);
              if (match.first) {
                add=true;
                score+=match.second;
                continue filter;
              }
            }
          }
        }
      }
      if (!add) {
        break;
      }
    }
    if (add) {
      matchScores.add(Pair.create(index,score));
      continue full;
    }
  }
  if (mAsyncMode) {
    Collections.sort(matchScores,new Comparator<Pair<Integer,Integer>>(){
      @Override public int compare(      Pair<Integer,Integer> lhs,      Pair<Integer,Integer> rhs){
        return lhs.second - rhs.second;
      }
    }
);
  }
  for (  Pair<Integer,Integer> match : matchScores) {
    matchList.add(full.get(match.first));
  }
  db.setTransactionSuccessful();
  db.endTransaction();
  if (cancelled) {
    return;
  }
  long time=System.currentTimeMillis() - startTime;
  if (time > 1000) {
    Logger.log("String_Node_Str","String_Node_Str" + time + "String_Node_Str");
  }
  context.runOnUiThread(new Runnable(){
    @Override public void run(){
      setCurrent(matchList);
      currentSearchTerms=searchTerms;
      update();
    }
  }
);
}