Skip to content

Commit

Permalink
LPS-32041 src format
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Han authored and brianchandotcom committed Sep 4, 2013
1 parent aefe4ad commit dd62a8b
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ public Map<String, List<String>> spellCheckKeywords(
String localizedFieldName = DocumentImpl.getLocalizedName(
searchContext.getLanguageId(), Field.SPELL_CHECK_WORD);

List<String> keywordTokens = TokenizerUtil.tokenize(
List<String> keywords = TokenizerUtil.tokenize(
localizedFieldName, searchContext.getKeywords(),
searchContext.getLanguageId());

for (String keywordToken : keywordTokens) {
for (String keyword : keywords) {
List<String> keywordSuggestions = suggestKeywords(
searchContext, maxSuggestions, keywordToken);
searchContext, maxSuggestions, keyword);

suggestions.put(keywordToken, keywordSuggestions);
suggestions.put(keyword, keywordSuggestions);
}

return suggestions;
Expand Down Expand Up @@ -217,20 +217,21 @@ protected List<String> suggestKeywords(
SearchContext searchContext, int maxSuggestions, String token)
throws SearchException {

Set<WeightedWord> suggestionSet = suggestKeywords(searchContext, token);
Set<WeightedWord> suggestionsSet = suggestKeywords(
searchContext, token);

maxSuggestions = Math.min(maxSuggestions, suggestionSet.size());
maxSuggestions = Math.min(maxSuggestions, suggestionsSet.size());

Iterator<WeightedWord> suggestionsIterator = suggestionSet.iterator();
Iterator<WeightedWord> suggestionsIterator = suggestionsSet.iterator();

List<String> suggestionList = new ArrayList<String>(maxSuggestions);
List<String> suggestionsList = new ArrayList<String>(maxSuggestions);

int counter = 0;

while (suggestionsIterator.hasNext()) {
WeightedWord weightedWord = suggestionsIterator.next();

suggestionList.add(weightedWord.getWord());
suggestionsList.add(weightedWord.getWord());

counter++;

Expand All @@ -239,7 +240,7 @@ protected List<String> suggestKeywords(
}
}

return suggestionList;
return suggestionsList;
}

protected Set<WeightedWord> suggestKeywords(
Expand Down

0 comments on commit dd62a8b

Please sign in to comment.