modify click count handling
This commit is contained in:
parent
1f45f49a69
commit
d6e842665e
1 changed files with 2 additions and 2 deletions
|
@ -246,14 +246,14 @@ public class SearchLogHelper {
|
|||
searchService.getDocumentListByDocIds(clickCountMap.keySet().toArray(new String[clickCountMap.size()]),
|
||||
new String[] { fessConfig.getIndexFieldDocId() }).forEach(
|
||||
doc -> {
|
||||
final String id = DocumentUtil.getValue(doc, fessConfig.getIndexFieldDocId(), String.class);
|
||||
final String id = DocumentUtil.getValue(doc, fessConfig.getIndexFieldId(), String.class);
|
||||
final String docId = DocumentUtil.getValue(doc, fessConfig.getIndexFieldDocId(), String.class);
|
||||
if (id != null && docId != null && clickCountMap.containsKey(docId)) {
|
||||
final Integer count = clickCountMap.get(docId);
|
||||
final Script script =
|
||||
new Script("ctx._source." + fessConfig.getIndexFieldClickCount() + "+=" + count.toString());
|
||||
final Map<String, Object> upsertMap = new HashMap<>();
|
||||
upsertMap.put(fessConfig.getIndexFieldClickCount(), 1);
|
||||
upsertMap.put(fessConfig.getIndexFieldClickCount(), count);
|
||||
builder.add(new UpdateRequest(fessConfig.getIndexDocumentUpdateIndex(), fessConfig
|
||||
.getIndexDocumentType(), id).script(script).upsert(upsertMap));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue