Revision 49865
Added by Argiro Kokogiannaki over 6 years ago
IndexResultHandler.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
SearchUtils searchUtils; |
13 | 13 |
|
14 |
private String fetchPublicationResult(String id) throws Exception { |
|
15 |
return searchUtils.fetchPublicationXmlFromIndex(id); |
|
14 |
private String fetchPublicationResult(String id, boolean production) throws Exception {
|
|
15 |
return searchUtils.fetchPublicationXmlFromIndex(id, production);
|
|
16 | 16 |
} |
17 |
|
|
18 |
private String fetchDatasetResult(String id) throws Exception { |
|
19 |
return searchUtils.fetchDatasetXmlFromIndex(id); |
|
17 |
private String fetchSoftwareResult(String id, boolean production) throws Exception { |
|
18 |
return searchUtils.fetchSoftwareXmlFromIndex(id, production); |
|
20 | 19 |
} |
21 |
private String fetchDedupPublicationResult(String id) throws Exception { |
|
22 |
return searchUtils.fetchDedupPublicationXmlFromIndex(id); |
|
23 |
} |
|
24 | 20 |
|
25 |
private String fetchDedupDatasetResult(String id) throws Exception {
|
|
26 |
return searchUtils.fetchDedupDatasetXmlFromIndex(id);
|
|
21 |
private String fetchDatasetResult(String id, boolean production) throws Exception {
|
|
22 |
return searchUtils.fetchDatasetXmlFromIndex(id, production);
|
|
27 | 23 |
} |
24 |
// private String fetchDedupPublicationResult(String id) throws Exception { |
|
25 |
// return searchUtils.fetchDedupPublicationXmlFromIndex(id); |
|
26 |
// } |
|
27 |
// |
|
28 |
// private String fetchDedupDatasetResult(String id) throws Exception { |
|
29 |
// return searchUtils.fetchDedupDatasetXmlFromIndex(id); |
|
30 |
// } |
|
28 | 31 |
/** |
29 | 32 |
*Searches for both publications and datasets |
30 | 33 |
* @param id |
31 | 34 |
* @return Result or null |
32 | 35 |
* @throws Exception |
33 | 36 |
*/ |
34 |
public Result fetchResultById(String id) throws Exception { |
|
37 |
public Result fetchResultById(String id, boolean production) throws Exception {
|
|
35 | 38 |
|
36 |
String oaf = fetchPublicationResult(id); |
|
39 |
String oaf = fetchPublicationResult(id, production);
|
|
37 | 40 |
|
38 | 41 |
if (oaf == null) { |
39 |
oaf = fetchDatasetResult(id); |
|
42 |
oaf = fetchDatasetResult(id, production);
|
|
40 | 43 |
} |
41 | 44 |
|
42 | 45 |
if (oaf == null) { |
... | ... | |
45 | 48 |
|
46 | 49 |
return OafParser.oaf2Result(oaf); |
47 | 50 |
} |
48 |
public Result fetchDedupResultById(String id) throws Exception { |
|
51 |
public Result fetchDedupById(String id, boolean production) throws Exception { |
|
52 |
String oaf = searchUtils.fetchDedupXmlFromIndex(id, production); |
|
53 |
if (oaf == null) { |
|
54 |
return null; |
|
55 |
} |
|
56 |
return OafParser.oaf2Result(oaf); |
|
57 |
} |
|
58 |
public Result fetchPublicationById(String id, boolean production) throws Exception { |
|
49 | 59 |
|
50 |
String oaf = fetchDedupPublicationResult(id);
|
|
60 |
String oaf = fetchPublicationResult(id, production);
|
|
51 | 61 |
|
52 | 62 |
if (oaf == null) { |
53 |
oaf = fetchDedupDatasetResult(id);
|
|
63 |
return null;
|
|
54 | 64 |
} |
55 | 65 |
|
66 |
return OafParser.oaf2Result(oaf); |
|
67 |
} |
|
68 |
public Result fetchDatasetById(String id, boolean production) throws Exception { |
|
69 |
|
|
70 |
String oaf = fetchDatasetResult(id, production); |
|
56 | 71 |
if (oaf == null) { |
57 | 72 |
return null; |
58 | 73 |
} |
59 | 74 |
|
60 | 75 |
return OafParser.oaf2Result(oaf); |
61 | 76 |
} |
77 |
public Result fetchSoftwareById(String id, boolean production) throws Exception { |
|
78 |
|
|
79 |
String oaf = fetchSoftwareResult(id, production); |
|
80 |
if (oaf == null) { |
|
81 |
return null; |
|
82 |
} |
|
83 |
return OafParser.oaf2Result(oaf); |
|
84 |
} |
|
85 |
// public Result fetchDedupResultById(String id) throws Exception { |
|
86 |
// |
|
87 |
// String oaf = fetchDedupPublicationResult(id); |
|
88 |
// |
|
89 |
// if (oaf == null) { |
|
90 |
// oaf = fetchDedupDatasetResult(id); |
|
91 |
// } |
|
92 |
// |
|
93 |
// if (oaf == null) { |
|
94 |
// return null; |
|
95 |
// } |
|
96 |
// |
|
97 |
// return OafParser.oaf2Result(oaf); |
|
98 |
// } |
|
62 | 99 |
public SearchUtils getSearchUtils() { |
63 | 100 |
return searchUtils; |
64 | 101 |
} |
Also available in: Unified diff
change migration procedure: search first in beta then in production| add software | change directIndexHandler check for response