Commit f27d932
[Port to dtq-dev] fix: Keep the requested scope and configuration in the /discover/search self link (#1421)
* fix(discovery): keep the requested scope and configuration in the /discover/search self link
/api/discover/search built its self link from a SearchConfigurationRest that
never received the scope and configuration the request carried, so the link
described a different request than the one it answered. The frontend then
logged a self-link mismatch warning for every scoped or configured search.
- DiscoverConfigurationConverter: convert() now takes the requested
configuration name and scope and sets them on SearchConfigurationRest, the
way DiscoverFacetConfigurationConverter already does for /discover/facets.
Both fields are @JsonIgnore, so only _links.self changes -- the JSON body is
untouched. The class no longer implements DSpaceConverter and getModelClass()
is gone, because the 4-arg signature does not fit that interface; nothing on
dtq-dev resolves this converter through ConverterService (no toRest() or
getConverter() call asks for DiscoveryConfiguration), so dropping the
registry entry orphans nothing.
- DiscoveryRestRepository.getSearchConfiguration(): pass both values through.
- DiscoverConfigurationConverterTest: adapt the existing call sites and add
testRequestedConfigurationAndScopeAreKept.
Port of DSpace/DSpace PR 12984 (still open upstream), commit 6477dfe.
Upstream tracking issue: DSpace/DSpace issue 8576. Adapted, not cherry-picked:
upstream is on 11.0-SNAPSHOT and its first hunk rewrites the class header, where
dtq-dev keeps an @Autowired ConfigurationService for the local
sort.options.filtered handling. That field, the filtering block and the
commons-lang v2 imports are left as they are. SearchConfigurationRest and
SearchConfigurationResourceHalLinkFactory need no change -- 7.6 already has the
@JsonIgnore scope/configuration fields and the link factory already reads them.
Fixes dataquest-dev/dspace-customers#934
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(discovery): cover the /discover/search self link in the IT that actually runs
The upstream patch adds discoverSearchSelfLinkKeepsScopeAndConfigurationTest to
DiscoveryRestControllerIT, but that class is @ignore'd at class level on dtq-dev
(since eb40d60, unrelated facet-configuration failures), so the test would
never execute here.
- DiscoveryRestControllerIT: add the upstream test verbatim, at the same spot,
so the file stays in step with upstream and future rebases stay clean. The
class-level @ignore is left alone; lifting it is a separate job.
- ClarinDiscoveryRestControllerIT: mirror the same test, in this file's
continuation-indent style. This is the fork's live copy of the discovery ITs
and it runs in CI, so this is where the fix is actually verified. The test
asserts only on $._links.self.href, so it is independent of the fork's
discovery.xml facet/sort customisations.
Fixes dataquest-dev/dspace-customers#934
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 23f3786 commit f27d932
5 files changed
Lines changed: 94 additions & 21 deletions
File tree
- dspace-server-webapp/src
- main/java/org/dspace/app/rest
- converter
- repository
- test/java/org/dspace/app/rest
- converter
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
1024 | 1051 | | |
1025 | 1052 | | |
1026 | 1053 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1265 | 1265 | | |
1266 | 1266 | | |
1267 | 1267 | | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
1268 | 1295 | | |
1269 | 1296 | | |
1270 | 1297 | | |
| |||
Lines changed: 29 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
77 | | - | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| |||
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
86 | | - | |
| 96 | + | |
| 97 | + | |
87 | 98 | | |
88 | 99 | | |
89 | 100 | | |
| |||
92 | 103 | | |
93 | 104 | | |
94 | 105 | | |
95 | | - | |
| 106 | + | |
| 107 | + | |
96 | 108 | | |
97 | 109 | | |
98 | 110 | | |
| |||
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
118 | | - | |
| 130 | + | |
| 131 | + | |
119 | 132 | | |
120 | 133 | | |
121 | 134 | | |
| |||
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
133 | | - | |
| 146 | + | |
| 147 | + | |
134 | 148 | | |
135 | 149 | | |
136 | 150 | | |
| |||
139 | 153 | | |
140 | 154 | | |
141 | 155 | | |
142 | | - | |
| 156 | + | |
| 157 | + | |
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
| |||
158 | 173 | | |
159 | 174 | | |
160 | 175 | | |
161 | | - | |
| 176 | + | |
| 177 | + | |
162 | 178 | | |
163 | 179 | | |
164 | 180 | | |
| |||
176 | 192 | | |
177 | 193 | | |
178 | 194 | | |
179 | | - | |
| 195 | + | |
| 196 | + | |
180 | 197 | | |
181 | 198 | | |
182 | 199 | | |
| |||
185 | 202 | | |
186 | 203 | | |
187 | 204 | | |
188 | | - | |
| 205 | + | |
| 206 | + | |
189 | 207 | | |
190 | 208 | | |
191 | 209 | | |
| |||
0 commit comments