Always carry a KorAPConnection object in the KorpusQuery object
Change-Id: If16e230cac95ce505a3fc198ce0ba03c5ced22d0
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 8081f01..1ca8123 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -11,6 +11,7 @@
#' @export
KorAPQuery <- setClass("KorAPQuery", slots = c(
+ "korapConnection",
"request",
"vc",
"totalResults",
@@ -27,6 +28,7 @@
#'
#' @rdname KorAPQuery-class
#' @param .Object …
+#' @param korapConnection KorAPConnection object
#' @param request query part of the request URL
#' @param vc definition of a virtual corpus
#' @param totalResults number of hits the query has yielded
@@ -39,10 +41,11 @@
#' @param collectedMatches matches already fetched from the KorAP-API-server
#' @export
setMethod("initialize", "KorAPQuery",
- function(.Object, request = NULL, vc="", totalResults=0, nextStartIndex=0, fields=c("corpusSigle", "textSigle", "pubDate", "pubPlace",
+ function(.Object, korapConnection = NULL, request = NULL, vc="", totalResults=0, nextStartIndex=0, fields=c("corpusSigle", "textSigle", "pubDate", "pubPlace",
"availability", "textClass", "snippet"),
requestUrl="", webUIRequestUrl = "", apiResponse = NULL, hasMoreMatches= FALSE, collectedMatches = NULL) {
.Object <- callNextMethod()
+ .Object@korapConnection = korapConnection
.Object@request = request
.Object@vc = vc
.Object@totalResults = totalResults
@@ -153,6 +156,7 @@
cat(" took ", res$meta$benchmark, "\n", sep="")
}
KorAPQuery(
+ korapConnection = kco,
nextStartIndex = 0,
fields = fields[!fields %in% contentFields],
requestUrl = requestUrl,
@@ -217,6 +221,7 @@
}
nextStartIndex <- min(res$meta$startIndex + res$meta$itemsPerPage, res$meta$totalResults)
KorAPQuery(nextStartIndex = nextStartIndex,
+ korapConnection = kco,
fields = kqo@fields,
requestUrl = kqo@requestUrl,
request = kqo@request,
diff --git a/man/KorAPQuery-class.Rd b/man/KorAPQuery-class.Rd
index 68d8907..c1fc185 100644
--- a/man/KorAPQuery-class.Rd
+++ b/man/KorAPQuery-class.Rd
@@ -15,11 +15,11 @@
\alias{show,KorAPQuery-method}
\title{Class KorAPQuery}
\usage{
-\S4method{initialize}{KorAPQuery}(.Object, request = NULL, vc = "",
- totalResults = 0, nextStartIndex = 0, fields = c("corpusSigle",
- "textSigle", "pubDate", "pubPlace", "availability", "textClass",
- "snippet"), requestUrl = "", webUIRequestUrl = "",
- apiResponse = NULL, hasMoreMatches = FALSE,
+\S4method{initialize}{KorAPQuery}(.Object, korapConnection = NULL,
+ request = NULL, vc = "", totalResults = 0, nextStartIndex = 0,
+ fields = c("corpusSigle", "textSigle", "pubDate", "pubPlace",
+ "availability", "textClass", "snippet"), requestUrl = "",
+ webUIRequestUrl = "", apiResponse = NULL, hasMoreMatches = FALSE,
collectedMatches = NULL)
\S4method{fetchNext}{KorAPQuery}(kqo, offset = kqo@nextStartIndex,
@@ -36,6 +36,8 @@
\arguments{
\item{.Object}{…}
+\item{korapConnection}{KorAPConnection object}
+
\item{request}{query part of the request URL}
\item{vc}{definition of a virtual corpus}