Skip to content

Apache Lucene open-source search software

SOLR-5378: Fix compile issues on Java6

Shalin Shekhar Mangarfd6268a9a882
diff --git a/solr/core/src/java/org/apache/solr/handler/component/SuggestComponent.java b/solr/core/src/java/org/apache/solr/handler/component/SuggestComponent.java
index c272c2af7e8..5aa08065f8f 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SuggestComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SuggestComponent.java
@@ -222,7 +222,7 @@ public class SuggestComponent extends SearchComponent implements SolrCoreAware,
return;
int count = params.getInt(SUGGEST_COUNT, 1);
- List<SuggesterResult> suggesterResults = new ArrayList<>();
+ List<SuggesterResult> suggesterResults = new ArrayList<SuggesterResult>();
NamedList response = new SimpleOrderedMap();
NamedList<NamedList> namedListResult = null;
@@ -252,7 +252,7 @@ public class SuggestComponent extends SearchComponent implements SolrCoreAware,
* */
private static SuggesterResult merge(List<SuggesterResult> suggesterResults, int count) {
SuggesterResult result = new SuggesterResult();
- Set<String> allTokens = new HashSet<>();
+ Set<String> allTokens = new HashSet<String>();
// collect all tokens
for (SuggesterResult shardResult : suggesterResults) {
@@ -272,7 +272,7 @@ public class SuggestComponent extends SearchComponent implements SolrCoreAware,
resultQueue.insertWithOverflow(res);
}
}
- List<LookupResult> sortedSuggests = new LinkedList<>();
+ List<LookupResult> sortedSuggests = new LinkedList<LookupResult>();
Collections.addAll(sortedSuggests, resultQueue.getResults());
result.add(token, sortedSuggests);
}
@@ -358,7 +358,7 @@ public class SuggestComponent extends SearchComponent implements SolrCoreAware,
// for each token
for(int i = 0; i < suggestions.size() ; i++) {
String tokenString = suggestions.getName(i);
- List<LookupResult> lookupResults = new ArrayList<>();
+ List<LookupResult> lookupResults = new ArrayList<LookupResult>();
NamedList suggestion = (NamedList) suggestions.getVal(i);
// for each suggestion
for (int j = 0; j < suggestion.size(); j++) {
@@ -366,7 +366,7 @@ public class SuggestComponent extends SearchComponent implements SolrCoreAware,
if (property.equals(SuggesterResultLabels.SUGGESTION)) {
NamedList suggestionEntry = (NamedList) suggestion.getVal(j);
String term = (String) suggestionEntry.get(SuggesterResultLabels.SUGGESTION_TERM);
- long weight = (long) suggestionEntry.get(SuggesterResultLabels.SUGGESTION_WEIGHT);
+ Long weight = (Long) suggestionEntry.get(SuggesterResultLabels.SUGGESTION_WEIGHT);
String payload = (String) suggestionEntry.get(SuggesterResultLabels.SUGGESTION_PAYLOAD);
LookupResult res = new LookupResult(new CharsRef(term), weight, new BytesRef(payload));
lookupResults.add(res);
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
index e624232e808..fc7736eb2f5 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
@@ -63,7 +63,7 @@ public class DocumentExpressionDictionaryFactory extends DictionaryFactory {
String field = (String) params.get(FIELD);
String payloadField = (String) params.get(PAYLOAD_FIELD);
String weightExpression = (String) params.get(WEIGHT_EXPRESSION);
- Set<SortField> sortFields = new HashSet<>();
+ Set<SortField> sortFields = new HashSet<SortField>();
if (field == null) {
throw new IllegalArgumentException(FIELD + " is a mandatory parameter");