blob: 114adac93be7085231a85531e8d7e416f22a9b6e [file] [log] [blame]
Nils Diewaldc7b60632014-09-05 19:59:01 +00001package de.ids_mannheim.korap.index;
2import de.ids_mannheim.korap.KorapMatch;
Nils Diewaldc471b182014-11-19 22:51:15 +00003import de.ids_mannheim.korap.response.KorapResponse;
Nils Diewald6aa929e2014-09-17 13:30:34 +00004import java.util.*;
Nils Diewaldc7b60632014-09-05 19:59:01 +00005
Nils Diewaldd723d812014-09-23 18:50:52 +00006public class MatchCollector extends KorapResponse {
7 public int totalResultDocs = 0;
Nils Diewaldc471b182014-11-19 22:51:15 +00008 private int totalResults;
9 private long totalTexts;
Nils Diewaldd723d812014-09-23 18:50:52 +000010
11 public void add (int uniqueDocID, int matchcount) {
12 this.totalResultDocs++;
13 this.incrTotalResults(matchcount);
14 };
15
16 public MatchCollector setTotalResultDocs (int i) {
17 this.totalResultDocs = i;
18 return this;
19 };
20
21 public MatchCollector incrTotalResultDocs (int i) {
22 this.totalResultDocs += i;
23 return this;
24 };
25
26 public int getTotalResultDocs () {
27 return totalResultDocs;
28 };
29
Nils Diewaldc471b182014-11-19 22:51:15 +000030 // Make this working in a KorapResult class
31 // that is independent from search and collection
32 public MatchCollector setTotalTexts (long i) {
33 this.totalTexts = i;
34 return this;
35 };
36
37 public long getTotalTexts() {
38 return this.totalTexts;
39 };
40
41 public MatchCollector setTotalResults (int i) {
42 this.totalResults = i;
43 return this;
44 };
45
46 public MatchCollector incrTotalResults (int i) {
47 this.totalResults += i;
48 return this;
49 };
50
51 public int getTotalResults() {
52 return this.totalResults;
53 };
54
Nils Diewaldd723d812014-09-23 18:50:52 +000055 public void commit() {};
Nils Diewaldad3f3032014-09-24 01:42:47 +000056 public void close() {};
Nils Diewaldc7b60632014-09-05 19:59:01 +000057
58 /*
59 * The following methods are shared and should be used from KorapResult
60 * And:
61 * getQueryHash
62 * getNode
63 */
Nils Diewaldc7b60632014-09-05 19:59:01 +000064};