Skip to content

Commit 3835c0a

Browse files
committed
fix: example KWIC download
Fixes #491
1 parent 54bd220 commit 3835c0a

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
- Setting `preselected_corpora` to empty list used to select all, now it selects none. To select all, leave it unset.
1414

15+
### Fixed
16+
17+
- Error when downloading example KWIC [#491](https://github.com/spraakbanken/korp-frontend/issues/491)
18+
1519
## [9.11.4] – 2025-09-29
1620

1721
### Fixed

app/scripts/components/kwic/results-examples.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ angular.module("korpApp").component("resultsExamples", {
4949
page="page"
5050
page-event="pageChange"
5151
hits-per-page="hitsPerPage"
52-
params="task.proxy.params"
52+
params="$ctrl.task.proxy.params"
5353
corpus-order="corpusOrder"
5454
on-update-search="onUpdateSearch()"
5555
></kwic>

app/scripts/kwic/kwic_download.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ function createFile(dataType: string, fileType: string, content: string) {
2222
return [filename, blobURL]
2323
}
2424

25-
function createSearchInfo(requestInfo: QueryParams, totalHits: number) {
25+
function createSearchInfo(requestInfo: Record<string, unknown>, totalHits: number) {
26+
// TODO Include cqpN if stats example
27+
// TODO Adjust for wordpic example
2628
return [
2729
`## CQP query: ${requestInfo.cqp}`,
2830
`## context: ${requestInfo.default_context}`,
@@ -148,7 +150,12 @@ function transformDataToKWIC(data: Row[], searchInfo: string[]) {
148150
return res
149151
}
150152

151-
function transformData(dataType: "annotations" | "kwic", data: Row[], requestInfo: QueryParams, totalHits: number) {
153+
function transformData(
154+
dataType: "annotations" | "kwic",
155+
data: Row[],
156+
requestInfo: Record<string, unknown>,
157+
totalHits: number,
158+
) {
152159
const searchInfo = createSearchInfo(requestInfo, totalHits)
153160
if (dataType === "annotations") {
154161
return transformDataToAnnotations(data as AnnotationsRow[], searchInfo)
@@ -172,7 +179,7 @@ export function makeDownload(
172179
dataType: "annotations" | "kwic",
173180
fileType: "csv" | "tsv",
174181
data: Row[],
175-
requestInfo: QueryParams,
182+
requestInfo: Record<string, unknown>,
176183
totalHits: number,
177184
) {
178185
const table = transformData(dataType, data, requestInfo, totalHits)

0 commit comments

Comments
 (0)