Added metadata (total results) to KorapResult.
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapMeta.java b/src/main/java/de/mannheim/ids/korap/sru/KorapMeta.java
new file mode 100644
index 0000000..2c29d99
--- /dev/null
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapMeta.java
@@ -0,0 +1,16 @@
+package de.mannheim.ids.korap.sru;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class KorapMeta {
+ private int totalResults;
+
+ public int getTotalResults () {
+ return totalResults;
+ }
+
+ public void setTotalResults (int totalResults) {
+ this.totalResults = totalResults;
+ }
+}
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapResult.java b/src/main/java/de/mannheim/ids/korap/sru/KorapResult.java
index 73b5a3b..95cf7f6 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapResult.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapResult.java
@@ -4,51 +4,55 @@
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class KorapResult {
- private int totalResults;
- private List<KorapMatch> matches;
- private List<List<Object>> errors;
-
- public KorapResult() {
- matches = new ArrayList<KorapMatch>();
- }
-
- public List<List<Object>> getErrors() {
+ private List<KorapMatch> matches;
+ private List<List<Object>> errors;
+ private KorapMeta metadata;
+
+ public KorapResult () {
+ matches = new ArrayList<KorapMatch>();
+ }
+
+ public int getTotalResults () {
+ return metadata.getTotalResults();
+ }
+
+ public List<List<Object>> getErrors () {
return errors;
}
- public void setErrors(List<List<Object>> errors) {
+ public void setErrors (List<List<Object>> errors) {
this.errors = errors;
}
- public int getTotalResults() {
- return totalResults;
- }
-
- public void setTotalResults(int totalResults) {
- this.totalResults = totalResults;
- }
-
- public List<KorapMatch> getMatches() {
+ public List<KorapMatch> getMatches () {
return matches;
}
-
- public void setMatches(List<KorapMatch> matches) {
- this.matches = matches;
- }
-
- public KorapMatch getMatch(int i){
- if (i>=0 && i< getMatchSize())
- return matches.get(i);
-
- return null;
- }
-
- public int getMatchSize(){
- return matches.size();
- }
-
-
+
+ public void setMatches (List<KorapMatch> matches) {
+ this.matches = matches;
+ }
+
+ public KorapMatch getMatch (int i) {
+ if (i >= 0 && i < getMatchSize())
+ return matches.get(i);
+
+ return null;
+ }
+
+ public int getMatchSize () {
+ return matches.size();
+ }
+
+ @JsonProperty("meta")
+ public KorapMeta getMetadata () {
+ return metadata;
+ }
+
+ public void setMetadata (KorapMeta metadata) {
+ this.metadata = metadata;
+ }
}
diff --git a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
index 59c1d65..706f312 100644
--- a/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
+++ b/src/main/java/de/mannheim/ids/korap/sru/KorapSRU.java
@@ -102,6 +102,7 @@
queryLanguage);
checkKorapResultError(korapResult, queryLanguage,
isRewitesAllowed(request), diagnostics);
+ logger.info("Number of records: "+korapResult.getTotalResults());
return new KorapSRUSearchResultSet(diagnostics, korapResult, dataviews,
korapEndpointDescription.getTextLayer(),
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 4f9be20..310893a 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,6 +1,5 @@
-log4j.rootLogger = ERROR, stdout
-log4j.rootLogger = info, stdout
-log4j.rootLogger = debug, stdout
+#log4j.rootLogger = ERROR, stdout
+log4j.rootLogger = DEBUG, stdout
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout