Skip to content

Commit f0ed27d

Browse files
committed
fallback for old URLs
1 parent be1743c commit f0ed27d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

web-ui/src/app/pages/example-based-search/example-based-search.component.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,25 @@ export class ExampleBasedSearchComponent extends MultiStepPageDirective<GlobalSt
6666
}
6767

6868
decodeGlobalState(queryParams: { [key: string]: any }): { [K in keyof GlobalStateExampleBased]?: GlobalStateExampleBased[K] } {
69+
let attributes: string[];
70+
let isCustomXPath: boolean;
71+
if (Array.isArray(queryParams.attributes)) {
72+
// fallback for old URLs
73+
attributes = queryParams.attributes;
74+
isCustomXPath = true; // preserve the existing XPath
75+
} else {
76+
attributes = queryParams.attributes?.split(attributesSeparator);
77+
isCustomXPath = this.decodeBool(queryParams.isCustomXPath)
78+
}
79+
6980
return {
7081
selectedTreebanks: new TreebankSelection(
7182
this.treebankService,
7283
queryParams.selectedTreebanks ? JSON.parse(queryParams.selectedTreebanks) : undefined),
7384
xpath: queryParams.xpath || undefined,
7485
inputSentence: queryParams.inputSentence || undefined,
75-
isCustomXPath: this.decodeBool(queryParams.isCustomXPath),
76-
attributes: this.alpinoService.attributesFromString(queryParams.attributes?.split(attributesSeparator)),
86+
isCustomXPath,
87+
attributes: this.alpinoService.attributesFromString(attributes),
7788
retrieveContext: this.decodeBool(queryParams.retrieveContext),
7889
respectOrder: this.decodeBool(queryParams.respectOrder),
7990
ignoreTopNode: this.decodeBool(queryParams.ignoreTopNode)

0 commit comments

Comments
 (0)