Skip to content

Commit

Permalink
Merge pull request #804 from support-project/feature/issue803_raw_tit…
Browse files Browse the repository at this point in the history
…le_on_webapi

#803 In case of searching with WebAPI, the highlight will be cancel o…
  • Loading branch information
koda-masaru authored Jul 20, 2017
2 parents 83b8c57 + 644554b commit a966ed7
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections4.map.HashedMap;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.common.util.PropertyUtil;
Expand Down Expand Up @@ -248,9 +250,22 @@ public List<Knowledge> selectList(SearchKnowledgeParam param) throws Exception {
param.getLoginedUser(),
param.getOffset(),
param.getLimit());
List<String> ids = new ArrayList<>();
for (KnowledgesEntity entity : entities) {
Knowledge result = conv(entity, LIST);
results.add(result);
ids.add(String.valueOf(result.getKnowledgeId()));
}
List<KnowledgesEntity> dbs = KnowledgeLogic.get().getKnowledges(ids, param.getLoginedUser());
Map<Long, KnowledgesEntity> idMap = new HashedMap<>();
for (KnowledgesEntity knowledgesEntity : dbs) {
idMap.put(knowledgesEntity.getKnowledgeId(), knowledgesEntity);
}
for (Knowledge knowledge : results) {
if (idMap.containsKey(knowledge.getKnowledgeId())) {
// Titleのハイライトを消す
knowledge.setTitle(idMap.get(knowledge.getKnowledgeId()).getTitle());
}
}
return results;
}
Expand Down

0 comments on commit a966ed7

Please sign in to comment.