Source:
private List<DBParameter> parametersToIndexRevision (BasicDocumentRevision rev, String indexName, List<String> fieldNames) { if (rev == null) { return null; } if(indexName == null) { return null; } if (fieldNames == null) { return null; } int arrayCount = 0; String arrayFieldName = null; for (String fieldName: fieldNames) { Object value = ValueExtractor.extractValueForFieldName(fieldName, rev.getBody()); if (value != null && value instanceof List) { arrayCount = arrayCount + 1; arrayFieldName = fieldName; } } if (arrayCount > 1) { String msg = String.format("Indexing %s in index %s includes >1 array field;", rev.getId(), indexName); msg = String.format("%s only array field per index allowed", msg); logger.log(Level.SEVERE, msg); return null; } List<DBParameter> parameters = new ArrayList<DBParameter>(); if (arrayCount == 1) { List<Object> arrayFieldValues; arrayFieldValues = (List) ValueExtractor.extractValueForFieldName(arrayFieldName, rev.getBody()); if (arrayFieldValues != null && arrayFieldValues.size() > 0) { for (Object value: arrayFieldValues) { List<String> initialIncludedFields = Arrays.asList("_id", "_rev", arrayFieldName); List<Object> initialArgs = Arrays.asList(rev.getId(), rev.getRevision(), value); DBParameter parameter = populateDBParameter(fieldNames, initialIncludedFields, initialArgs, indexName, rev); if (parameter == null) { return null; } parameters.add(parameter); } return parameters; } } List<String> initialIncludedFields = Arrays.asList("_id", "_rev"); List<Object> initialArgs = Arrays.<Object>asList(rev.getId(), rev.getRevision()); DBParameter parameter = populateDBParameter(fieldNames, initialIncludedFields, initialArgs, indexName, rev); if (parameter == null) { return null; } parameters.add(parameter); return parameters; }

Target:
private List<DBParameter> parametersToIndexRevision (BasicDocumentRevision rev, String indexName, List<String> fieldNames) { if (rev == null) { return null; } if(indexName == null) { return null; } if (fieldNames == null) { return null; } int arrayCount = 0; String arrayFieldName = null; for (String fieldName: fieldNames) { Object value = ValueExtractor.extractValueForFieldName(fieldName, rev.getBody()); if (value != null && value instanceof List) { arrayCount = arrayCount + 1; arrayFieldName = fieldName; } } if (arrayCount > 1) { String msg = String.format("Indexing %s in index %s includes > 1 array field; " + "Only one array field per index allowed.", rev.getId(), indexName); logger.log(Level.SEVERE, msg); return null; } List<DBParameter> parameters = new ArrayList<DBParameter>(); List<Object> arrayFieldValues = null; if (arrayCount == 1) { arrayFieldValues = (List) ValueExtractor.extractValueForFieldName(arrayFieldName, rev.getBody()); } if (arrayFieldValues != null && arrayFieldValues.size() > 0) { for (Object value: arrayFieldValues) { List<String> initialIncludedFields = Arrays.asList("_id", "_rev", arrayFieldName); List<Object> initialArgs = Arrays.asList(rev.getId(), rev.getRevision(), value); DBParameter parameter = populateDBParameter(fieldNames, initialIncludedFields, initialArgs, indexName, rev); if (parameter == null) { return null; } parameters.add(parameter); } } else { List<String> initialIncludedFields = Arrays.asList("_id", "_rev"); List<Object> initialArgs = Arrays.<Object>asList(rev.getId(), rev.getRevision()); DBParameter parameter = populateDBParameter(fieldNames, initialIncludedFields, initialArgs, indexName, rev); if (parameter == null) { return null; } parameters.add(parameter); } return parameters; }