Skip to content

Commit 2b61bb5

Browse files
author
Burak Serdar
committed
fix #671: Count results during copy
1 parent 7df5bb8 commit 2b61bb5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

crud/src/main/java/com/redhat/lightblue/assoc/ep/Copy.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public StepResult<ResultDocument> getResults(ExecutionContext ctx) {
4444
public Stream<ResultDocument> stream() {
4545
// Create new documents for each document in the source. This will
4646
// create the correct slots based on this execution block
47-
return super.stream().map(d -> new ResultDocument(block, d.getDoc()));
47+
return super.stream().map(d -> {
48+
if(recordResultSetSize)
49+
ctx.incMatchCount();
50+
return new ResultDocument(block, d.getDoc());
51+
});
4852
}
4953
};
5054
}

crud/src/main/java/com/redhat/lightblue/assoc/ep/ExecutionContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public void setMatchCount(int c) {
5555
matchCount = c;
5656
}
5757

58+
public void incMatchCount() {
59+
matchCount++;
60+
}
61+
5862
public void close() {
5963
executor.shutdown();
6064
}

0 commit comments

Comments
 (0)