@Override public boolean addFieldsToVertexDocument(SearchIndex searchIndex, XContentBuilder jsonBuilder, Vertex vertex, GetResponse existingDocument, Authorizations authorizations) throws IOException { if (existingDocument != null && !getConfig().isUpdateEdgeBoost()) { return false; } boolean changed = false; int inEdgeCount = vertex.getEdgeCount(Direction.IN, authorizations); Long existingInEdgeCount = existingDocument == null ? null : GetResponseUtil.getFieldValueLong(existingDocument, EdgeCountScoringStrategyConfiguration.IN_EDGE_COUNT_FIELD_NAME); if (existingInEdgeCount == null || existingInEdgeCount.intValue() != inEdgeCount) { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.IN_EDGE_COUNT_FIELD_NAME, inEdgeCount); changed = true; } else { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.IN_EDGE_COUNT_FIELD_NAME, existingInEdgeCount.intValue()); } int outEdgeCount = vertex.getEdgeCount(Direction.OUT, authorizations); Long existingOutEdgeCount = existingDocument == null ? null : GetResponseUtil.getFieldValueLong(existingDocument, EdgeCountScoringStrategyConfiguration.OUT_EDGE_COUNT_FIELD_NAME); if (existingOutEdgeCount == null || existingOutEdgeCount.intValue() != outEdgeCount) { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.OUT_EDGE_COUNT_FIELD_NAME, outEdgeCount); changed = true; } else { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.OUT_EDGE_COUNT_FIELD_NAME, existingOutEdgeCount.intValue()); } return changed; }
@Override public boolean addFieldsToVertexDocument(SearchIndex searchIndex, XContentBuilder jsonBuilder, Vertex vertex, GetResponse existingDocument, Authorizations authorizations) throws IOException { if (existingDocument != null && !getConfig().isUpdateEdgeBoost()) { return false; } boolean changed = false; int inEdgeCount = vertex.getEdgeCount(Direction.IN, authorizations); Long existingInEdgeCount = existingDocument == null ? null : GetResponseUtil.getFieldValueLong(existingDocument, EdgeCountScoringStrategyConfiguration.IN_EDGE_COUNT_FIELD_NAME); if (existingInEdgeCount == null || existingInEdgeCount.intValue() != inEdgeCount) { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.IN_EDGE_COUNT_FIELD_NAME, inEdgeCount); changed = true; } else { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.IN_EDGE_COUNT_FIELD_NAME, existingInEdgeCount.intValue()); } int outEdgeCount = vertex.getEdgeCount(Direction.OUT, authorizations); Long existingOutEdgeCount = existingDocument == null ? null : GetResponseUtil.getFieldValueLong(existingDocument, EdgeCountScoringStrategyConfiguration.OUT_EDGE_COUNT_FIELD_NAME); if (existingOutEdgeCount == null || existingOutEdgeCount.intValue() != outEdgeCount) { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.OUT_EDGE_COUNT_FIELD_NAME, outEdgeCount); changed = true; } else { jsonBuilder.field(EdgeCountScoringStrategyConfiguration.OUT_EDGE_COUNT_FIELD_NAME, existingOutEdgeCount.intValue()); } return changed; }