1 |
57027
|
konstantin
|
import {Component, Input} from '@angular/core';
|
2 |
56091
|
argiro.kok
|
import {ChangeDetectionStrategy} from '@angular/core';
|
3 |
|
|
import {ViewEncapsulation} from '@angular/core';
|
4 |
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
5 |
|
|
import {Location} from '@angular/common';
|
6 |
|
|
import {Title, Meta} from '@angular/platform-browser';
|
7 |
50169
|
argiro.kok
|
|
8 |
57027
|
konstantin
|
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
|
9 |
56091
|
argiro.kok
|
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
10 |
|
|
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
|
11 |
|
|
import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class';
|
12 |
50169
|
argiro.kok
|
|
13 |
57027
|
konstantin
|
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
|
14 |
56091
|
argiro.kok
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
15 |
|
|
import {SearchProjectsService} from '../../services/searchProjects.service';
|
16 |
|
|
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
|
17 |
50169
|
argiro.kok
|
|
18 |
57027
|
konstantin
|
import {SearchFields} from '../../utils/properties/searchFields';
|
19 |
56091
|
argiro.kok
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
20 |
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
21 |
|
|
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
|
22 |
|
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
23 |
|
|
import {ConfigurationService} from '../../utils/configuration/configuration.service';
|
24 |
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
25 |
|
|
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
26 |
|
|
import {StringUtils} from '../../utils/string-utils.class';
|
27 |
56059
|
argiro.kok
|
import {SearchCustomFilter} from "../searchUtils/searchUtils.class";
|
28 |
58275
|
k.triantaf
|
import {Observable, Subscription} from "rxjs";
|
29 |
50169
|
argiro.kok
|
|
30 |
|
|
@Component({
|
31 |
|
|
changeDetection: ChangeDetectionStrategy.Default,
|
32 |
|
|
encapsulation: ViewEncapsulation.Emulated,
|
33 |
56091
|
argiro.kok
|
selector: 'search-find',
|
34 |
|
|
templateUrl: 'search.component.html'
|
35 |
50169
|
argiro.kok
|
})
|
36 |
|
|
export class SearchComponent {
|
37 |
56091
|
argiro.kok
|
public sub: any;
|
38 |
|
|
piwiksub: any;
|
39 |
50169
|
argiro.kok
|
public reloadPublications: boolean;
|
40 |
|
|
public reloadDatasets: boolean;
|
41 |
|
|
public reloadSoftware: boolean;
|
42 |
52816
|
konstantin
|
public reloadOrps: boolean;
|
43 |
50169
|
argiro.kok
|
public reloadProjects: boolean;
|
44 |
|
|
public reloadDataproviders: boolean;
|
45 |
|
|
public reloadOrganizations: boolean;
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
public pageTitle = "Search in OpenAIRE"
|
49 |
56091
|
argiro.kok
|
public keyword: string = "";
|
50 |
|
|
public publications: string[];
|
51 |
|
|
public datasets: string[];
|
52 |
|
|
public software: string[];
|
53 |
|
|
public orps: string[];
|
54 |
|
|
public projectsTab: string[];
|
55 |
|
|
public dataproviders: string[];
|
56 |
|
|
public organizations: string[];
|
57 |
50169
|
argiro.kok
|
|
58 |
|
|
public activeTab = "publications";
|
59 |
|
|
public linkToSearchPublications = "";
|
60 |
|
|
public linkToSearchProjects = "";
|
61 |
|
|
public linkToSearchDataproviders = "";
|
62 |
|
|
public linkToSearchDatasets = "";
|
63 |
|
|
public linkToSearchSoftware = "";
|
64 |
52816
|
konstantin
|
public linkToSearchOrps = "";
|
65 |
50169
|
argiro.kok
|
public linkToSearchOrganizations = "";
|
66 |
|
|
|
67 |
57027
|
konstantin
|
public fetchPublications: FetchResearchResults;
|
68 |
56091
|
argiro.kok
|
public fetchDataproviders: FetchDataproviders;
|
69 |
|
|
public fetchProjects: FetchProjects;
|
70 |
57027
|
konstantin
|
public fetchDatasets: FetchResearchResults;
|
71 |
|
|
public fetchSoftware: FetchResearchResults;
|
72 |
|
|
public fetchOrps: FetchResearchResults;
|
73 |
50169
|
argiro.kok
|
public fetchOrganizations: FetchOrganizations;
|
74 |
|
|
|
75 |
56091
|
argiro.kok
|
public searchFields: SearchFields = new SearchFields();
|
76 |
|
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
77 |
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
78 |
50169
|
argiro.kok
|
|
79 |
56091
|
argiro.kok
|
public publicationsSize: any = null;
|
80 |
|
|
public datasetsSize: any = null;
|
81 |
|
|
public softwareSize: any = null;
|
82 |
|
|
public oprsSize: any = null;
|
83 |
|
|
public fundersSize: any = null;
|
84 |
|
|
public projectsSize: any = null;
|
85 |
|
|
public datasourcesSize: any = null;
|
86 |
|
|
showPublications: boolean = false;
|
87 |
|
|
showDatasets: boolean = false;
|
88 |
|
|
showSoftware: boolean = false;
|
89 |
|
|
showOrps: boolean = false;
|
90 |
|
|
showProjects: boolean = false;
|
91 |
|
|
showDataProviders: boolean = false;
|
92 |
|
|
showOrganizations: boolean = false;
|
93 |
|
|
advancedSearchLink: string = "/search/advanced/publications";
|
94 |
50586
|
argiro.kok
|
properties: EnvProperties;
|
95 |
53724
|
argiro.kok
|
@Input() logoURL;
|
96 |
|
|
@Input() name;
|
97 |
56091
|
argiro.kok
|
@Input() customFilter: SearchCustomFilter = null;
|
98 |
53860
|
argiro.kok
|
@Input() piwikSiteId = null;
|
99 |
54206
|
argiro.kok
|
@Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE";
|
100 |
53740
|
argiro.kok
|
|
101 |
54206
|
argiro.kok
|
|
102 |
56091
|
argiro.kok
|
public subPub;
|
103 |
|
|
public subData;
|
104 |
|
|
public subSoftware;
|
105 |
|
|
public subOrps;
|
106 |
|
|
public subProjects;
|
107 |
|
|
public subOrg;
|
108 |
|
|
public subDataPr;
|
109 |
50169
|
argiro.kok
|
|
110 |
56091
|
argiro.kok
|
constructor(private route: ActivatedRoute,
|
111 |
|
|
private _router: Router,
|
112 |
57027
|
konstantin
|
private _searchResearchResultsService: SearchResearchResultsService,
|
113 |
56091
|
argiro.kok
|
private _searchDataprovidersService: SearchDataprovidersService,
|
114 |
|
|
private _searchProjectsService: SearchProjectsService,
|
115 |
|
|
private _searchOrganizationsService: SearchOrganizationsService,
|
116 |
|
|
private _refineFieldResultsService: RefineFieldResultsService,
|
117 |
|
|
private location: Location,
|
118 |
|
|
private _meta: Meta,
|
119 |
|
|
private _title: Title,
|
120 |
|
|
private _piwikService: PiwikService,
|
121 |
|
|
private config: ConfigurationService,
|
122 |
|
|
private seoService: SEOService) {
|
123 |
57027
|
konstantin
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
124 |
56091
|
argiro.kok
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
125 |
|
|
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
126 |
57027
|
konstantin
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
127 |
|
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
128 |
|
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
129 |
56091
|
argiro.kok
|
this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
|
130 |
|
|
|
131 |
50169
|
argiro.kok
|
}
|
132 |
|
|
|
133 |
|
|
public ngOnInit() {
|
134 |
50586
|
argiro.kok
|
this.route.data
|
135 |
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
136 |
50169
|
argiro.kok
|
|
137 |
50586
|
argiro.kok
|
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
|
138 |
|
|
var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE";
|
139 |
|
|
this.properties = data.envSpecific;
|
140 |
56091
|
argiro.kok
|
var url = data.envSpecific.baseLink + this._router.url;
|
141 |
51835
|
sofia.balt
|
this._title.setTitle(title);
|
142 |
56091
|
argiro.kok
|
this._meta.updateTag({content: description}, "name='description'");
|
143 |
|
|
this._meta.updateTag({content: description}, "property='og:description'");
|
144 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
145 |
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
146 |
|
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
|
147 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
148 |
53860
|
argiro.kok
|
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe();
|
149 |
50586
|
argiro.kok
|
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
|
153 |
58391
|
argiro.kok
|
if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || this.properties.adminToolsCommunity) {
|
154 |
|
|
this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
|
155 |
56091
|
argiro.kok
|
var showEntity = {};
|
156 |
|
|
for (var i = 0; i < data['entities'].length; i++) {
|
157 |
50586
|
argiro.kok
|
|
158 |
56091
|
argiro.kok
|
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
|
159 |
|
|
}
|
160 |
|
|
this.showPublications = showEntity["publication"];
|
161 |
|
|
this.showDatasets = showEntity["dataset"];
|
162 |
|
|
this.showProjects = showEntity["project"];
|
163 |
|
|
this.showOrganizations = showEntity["organization"];
|
164 |
|
|
this.showDataProviders = showEntity["datasource"];
|
165 |
|
|
this.showSoftware = showEntity["software"];
|
166 |
|
|
this.showOrps = showEntity["orp"];
|
167 |
|
|
if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
|
168 |
|
|
this.showProjects = false;
|
169 |
|
|
this.showOrganizations = false;
|
170 |
|
|
this.showDataProviders = false;
|
171 |
|
|
}
|
172 |
|
|
this.loadAll();
|
173 |
50586
|
argiro.kok
|
|
174 |
56091
|
argiro.kok
|
});
|
175 |
|
|
} else {
|
176 |
|
|
if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
|
177 |
|
|
this.showPublications =true;
|
178 |
|
|
this.showDatasets = true;
|
179 |
|
|
this.showDataProviders = true;
|
180 |
|
|
this.showSoftware = true;
|
181 |
|
|
this.showOrps = true;
|
182 |
|
|
this.showProjects = true;
|
183 |
|
|
this.showOrganizations = true;
|
184 |
|
|
this.showDataProviders = true;
|
185 |
50169
|
argiro.kok
|
}
|
186 |
56059
|
argiro.kok
|
}
|
187 |
56091
|
argiro.kok
|
this.loadAll();
|
188 |
|
|
});
|
189 |
|
|
}
|
190 |
52816
|
konstantin
|
|
191 |
56091
|
argiro.kok
|
loadAll() {
|
192 |
|
|
this.sub = this.route.queryParams.subscribe(params => {
|
193 |
50586
|
argiro.kok
|
|
194 |
56091
|
argiro.kok
|
this.reloadTabs();
|
195 |
|
|
this.keyword = (params['keyword']) ? params['keyword'] : "";
|
196 |
|
|
if (this.keyword != null && this.keyword.length > 0) {
|
197 |
|
|
//if showPublications == false will setValues another entity as the first
|
198 |
|
|
if (this.showPublications) {
|
199 |
|
|
this.activeTab = "publications";
|
200 |
|
|
this.searchPublications();
|
201 |
|
|
} else if (this.showDatasets) {
|
202 |
|
|
this.activeTab = "research data";
|
203 |
|
|
this.searchDatasets();
|
204 |
|
|
} else if (this.showSoftware) {
|
205 |
|
|
this.activeTab = "software";
|
206 |
|
|
this.searchSoftware();
|
207 |
|
|
} else if (this.showOrps) {
|
208 |
|
|
this.activeTab = "other research products";
|
209 |
|
|
this.searchOrps();
|
210 |
|
|
} else if (this.showProjects) {
|
211 |
|
|
this.activeTab = "projects";
|
212 |
|
|
this.searchProjects();
|
213 |
|
|
} else if (this.showDataProviders) {
|
214 |
|
|
this.activeTab = "content providers";
|
215 |
|
|
this.searchDataProviders();
|
216 |
|
|
} else if (this.showOrganizations) {
|
217 |
|
|
this.activeTab = "organizations";
|
218 |
|
|
this.searchOrganizations();
|
219 |
|
|
}
|
220 |
|
|
this.count();
|
221 |
50586
|
argiro.kok
|
}
|
222 |
56091
|
argiro.kok
|
});
|
223 |
|
|
}
|
224 |
50169
|
argiro.kok
|
|
225 |
50586
|
argiro.kok
|
|
226 |
50169
|
argiro.kok
|
public ngOnDestroy() {
|
227 |
56091
|
argiro.kok
|
if (this.sub) {
|
228 |
53026
|
argiro.kok
|
this.sub.unsubscribe();
|
229 |
|
|
}
|
230 |
56091
|
argiro.kok
|
if (this.piwiksub) {
|
231 |
|
|
this.piwiksub.unsubscribe();
|
232 |
|
|
}
|
233 |
|
|
if (this.keyword != null && this.keyword.length > 0) {
|
234 |
|
|
if (this.subPub) {
|
235 |
|
|
this.subPub.unsubscribe();
|
236 |
50586
|
argiro.kok
|
}
|
237 |
56091
|
argiro.kok
|
if (this.subData) {
|
238 |
|
|
this.subData.unsubscribe();
|
239 |
|
|
}
|
240 |
|
|
if (this.subSoftware) {
|
241 |
|
|
this.subSoftware.unsubscribe();
|
242 |
|
|
}
|
243 |
|
|
if (this.subOrps) {
|
244 |
|
|
this.subOrps.unsubscribe();
|
245 |
|
|
}
|
246 |
|
|
if (this.subProjects) {
|
247 |
|
|
this.subProjects.unsubscribe();
|
248 |
|
|
}
|
249 |
|
|
if (this.subOrg) {
|
250 |
|
|
this.subOrg.unsubscribe();
|
251 |
|
|
}
|
252 |
|
|
if (this.subDataPr) {
|
253 |
|
|
this.subDataPr.unsubscribe();
|
254 |
|
|
}
|
255 |
50169
|
argiro.kok
|
|
256 |
|
|
}
|
257 |
|
|
}
|
258 |
56091
|
argiro.kok
|
|
259 |
50169
|
argiro.kok
|
public searchPublications() {
|
260 |
|
|
this.activeTab = "publications";
|
261 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications";
|
262 |
56091
|
argiro.kok
|
if (this.reloadPublications &&
|
263 |
|
|
this.fetchPublications.searchUtils.status != this.errorCodes.NONE /*&&
|
264 |
57200
|
konstantin
|
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/
|
265 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
266 |
50169
|
argiro.kok
|
this.reloadPublications = false;
|
267 |
57027
|
konstantin
|
this.fetchPublications.getResultsByKeyword("publication", this.keyword, 1, 10, this.properties, this.customFilter);
|
268 |
50586
|
argiro.kok
|
this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword;
|
269 |
50169
|
argiro.kok
|
}
|
270 |
56091
|
argiro.kok
|
}
|
271 |
|
|
|
272 |
|
|
public searchDatasets() {
|
273 |
|
|
this.activeTab = "research data";
|
274 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedDatasets;//"/search/advanced/datasets";
|
275 |
56091
|
argiro.kok
|
if (this.reloadDatasets &&
|
276 |
|
|
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE /*&&
|
277 |
57200
|
konstantin
|
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/
|
278 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
279 |
56091
|
argiro.kok
|
this.reloadDatasets = false;
|
280 |
57027
|
konstantin
|
this.fetchDatasets.getResultsByKeyword("dataset", this.keyword, 1, 10, this.properties, this.customFilter);
|
281 |
56091
|
argiro.kok
|
this.linkToSearchDatasets = this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword;
|
282 |
|
|
}
|
283 |
|
|
}
|
284 |
52816
|
konstantin
|
|
285 |
56091
|
argiro.kok
|
public searchSoftware() {
|
286 |
|
|
|
287 |
|
|
this.activeTab = "software";
|
288 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedSoftware;//"/search/advanced/software";
|
289 |
56091
|
argiro.kok
|
if (this.reloadSoftware
|
290 |
|
|
&& this.fetchSoftware.searchUtils.status != this.errorCodes.NONE/* &&
|
291 |
50169
|
argiro.kok
|
( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
292 |
57200
|
konstantin
|
this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/
|
293 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
294 |
56091
|
argiro.kok
|
this.reloadSoftware = false;
|
295 |
57027
|
konstantin
|
this.fetchSoftware.getResultsByKeyword("software", this.keyword, 1, 10, this.properties, this.customFilter);
|
296 |
56091
|
argiro.kok
|
this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword;
|
297 |
|
|
}
|
298 |
|
|
}
|
299 |
|
|
|
300 |
|
|
public searchOrps() {
|
301 |
|
|
this.activeTab = "other research products";
|
302 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrps;//"/search/advanced/other";
|
303 |
56091
|
argiro.kok
|
if (this.reloadOrps &&
|
304 |
|
|
this.fetchOrps.searchUtils.status != this.errorCodes.NONE /*&&
|
305 |
57200
|
konstantin
|
this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/
|
306 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
307 |
56091
|
argiro.kok
|
this.reloadOrps = false;
|
308 |
57027
|
konstantin
|
this.fetchOrps.getResultsByKeyword("other", this.keyword, 1, 10, this.properties, this.customFilter);
|
309 |
56091
|
argiro.kok
|
this.linkToSearchOrps = this.properties.searchLinkToOrps;
|
310 |
|
|
}
|
311 |
|
|
}
|
312 |
|
|
|
313 |
|
|
public searchProjects() {
|
314 |
|
|
this.activeTab = "projects";
|
315 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects";
|
316 |
56091
|
argiro.kok
|
if (this.reloadProjects &&
|
317 |
|
|
this.fetchProjects.searchUtils.status != this.errorCodes.NONE /*&&
|
318 |
57200
|
konstantin
|
this.fetchProjects.searchUtils.status != this.errorCodes.ERROR*/
|
319 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
320 |
56091
|
argiro.kok
|
this.reloadProjects = false;
|
321 |
|
|
this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
|
322 |
|
|
this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword;
|
323 |
|
|
}
|
324 |
|
|
}
|
325 |
|
|
|
326 |
|
|
public searchDataProviders() {
|
327 |
|
|
this.activeTab = "content providers";
|
328 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders";
|
329 |
56091
|
argiro.kok
|
if (this.reloadDataproviders &&
|
330 |
|
|
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE /*&&
|
331 |
57200
|
konstantin
|
this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR*/
|
332 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
333 |
56091
|
argiro.kok
|
this.reloadDataproviders = false;
|
334 |
|
|
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
|
335 |
|
|
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword;
|
336 |
|
|
}
|
337 |
|
|
}
|
338 |
|
|
|
339 |
|
|
public searchOrganizations() {
|
340 |
|
|
this.activeTab = "organizations";
|
341 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
|
342 |
56091
|
argiro.kok
|
if (this.reloadOrganizations &&
|
343 |
|
|
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE /*&&
|
344 |
57200
|
konstantin
|
this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR*/
|
345 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
346 |
56091
|
argiro.kok
|
this.reloadOrganizations = false;
|
347 |
|
|
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
|
348 |
|
|
this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword;
|
349 |
|
|
}
|
350 |
|
|
}
|
351 |
50169
|
argiro.kok
|
|
352 |
|
|
|
353 |
56091
|
argiro.kok
|
public keywordChanged($event) {
|
354 |
50169
|
argiro.kok
|
|
355 |
|
|
this.keyword = $event.value;
|
356 |
54775
|
konstantin
|
//console.info("Search Find: search with keyword \"" + this.keyword + "\"" );
|
357 |
56091
|
argiro.kok
|
this.location.go(location.pathname, "?keyword=" + this.keyword);
|
358 |
50169
|
argiro.kok
|
this.reloadTabs();
|
359 |
56091
|
argiro.kok
|
if (this.activeTab == "publications") {
|
360 |
50169
|
argiro.kok
|
this.searchPublications();
|
361 |
|
|
}
|
362 |
56091
|
argiro.kok
|
if (this.activeTab == "projects") {
|
363 |
50169
|
argiro.kok
|
this.searchProjects();
|
364 |
|
|
}
|
365 |
56091
|
argiro.kok
|
if (this.activeTab == "content providers") {
|
366 |
50169
|
argiro.kok
|
this.searchDataProviders();
|
367 |
|
|
}
|
368 |
56091
|
argiro.kok
|
if (this.activeTab == "research data") {
|
369 |
50169
|
argiro.kok
|
this.searchDatasets();
|
370 |
|
|
}
|
371 |
56091
|
argiro.kok
|
if (this.activeTab == "software") {
|
372 |
50169
|
argiro.kok
|
this.searchSoftware();
|
373 |
|
|
}
|
374 |
56091
|
argiro.kok
|
if (this.activeTab == "other research products") {
|
375 |
52816
|
konstantin
|
this.searchOrps();
|
376 |
|
|
}
|
377 |
56091
|
argiro.kok
|
if (this.activeTab == "organizations") {
|
378 |
50169
|
argiro.kok
|
this.searchOrganizations();
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
this.count();
|
382 |
56091
|
argiro.kok
|
}
|
383 |
50169
|
argiro.kok
|
|
384 |
56091
|
argiro.kok
|
private count() {
|
385 |
|
|
var refineParams = null;
|
386 |
|
|
if (this.customFilter) {
|
387 |
|
|
refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
388 |
|
|
}
|
389 |
|
|
if (this.activeTab != "publications" && this.showPublications) {
|
390 |
50169
|
argiro.kok
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
391 |
|
|
this.fetchPublications.results = [];
|
392 |
53860
|
argiro.kok
|
|
393 |
57084
|
konstantin
|
this.subPub = this.numOfSearchResults("publication", this.fetchPublications, refineParams);
|
394 |
50169
|
argiro.kok
|
}
|
395 |
56091
|
argiro.kok
|
if (this.activeTab != "research data" && this.showDatasets) {
|
396 |
|
|
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
|
397 |
|
|
this.fetchDatasets.results = [];
|
398 |
57084
|
konstantin
|
this.subData = this.numOfSearchResults("dataset", this.fetchDatasets, refineParams);
|
399 |
50169
|
argiro.kok
|
}
|
400 |
56091
|
argiro.kok
|
if (this.activeTab != "software" && this.showSoftware) {
|
401 |
|
|
this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING;
|
402 |
|
|
this.fetchSoftware.results = [];
|
403 |
57084
|
konstantin
|
this.subSoftware = this.numOfSearchResults("software", this.fetchSoftware, refineParams);
|
404 |
50169
|
argiro.kok
|
}
|
405 |
56091
|
argiro.kok
|
if (this.activeTab != "other research products" && this.showOrps) {
|
406 |
|
|
this.fetchOrps.searchUtils.status = this.errorCodes.LOADING;
|
407 |
|
|
this.fetchOrps.results = [];
|
408 |
57084
|
konstantin
|
this.subOrps = this.numOfSearchResults("other", this.fetchOrps, refineParams);
|
409 |
52816
|
konstantin
|
}
|
410 |
56091
|
argiro.kok
|
if (this.activeTab != "projects" && this.showProjects) {
|
411 |
50169
|
argiro.kok
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
412 |
|
|
this.fetchProjects.results = [];
|
413 |
56091
|
argiro.kok
|
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword, this.properties, refineParams).subscribe(
|
414 |
|
|
data => {
|
415 |
|
|
this.fetchProjects.searchUtils.totalResults = data;
|
416 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
|
417 |
|
|
if (this.fetchProjects.searchUtils.totalResults == 0) {
|
418 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
|
419 |
|
|
}
|
420 |
|
|
},
|
421 |
|
|
err => {
|
422 |
|
|
//console.log(err);
|
423 |
|
|
this.handleError("Error getting number of Projects", err);
|
424 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
|
425 |
|
|
}
|
426 |
|
|
);
|
427 |
|
|
}
|
428 |
|
|
if (this.activeTab != "content providers" && this.showDataProviders) {
|
429 |
|
|
this.fetchDataproviders.results = [];
|
430 |
|
|
this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
|
431 |
|
|
}
|
432 |
|
|
if (this.activeTab != "organizations" && this.showOrganizations) {
|
433 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
434 |
|
|
this.fetchOrganizations.results = [];
|
435 |
|
|
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword, this.properties, refineParams).subscribe(
|
436 |
|
|
data => {
|
437 |
|
|
this.fetchOrganizations.searchUtils.totalResults = data;
|
438 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
|
439 |
|
|
if (this.fetchOrganizations.searchUtils.totalResults == 0) {
|
440 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
|
441 |
|
|
}
|
442 |
|
|
},
|
443 |
|
|
err => {
|
444 |
|
|
//console.log(err);
|
445 |
|
|
this.handleError("Error getting number of Organizations", err);
|
446 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
|
447 |
50169
|
argiro.kok
|
|
448 |
56091
|
argiro.kok
|
}
|
449 |
|
|
);
|
450 |
|
|
}
|
451 |
50169
|
argiro.kok
|
|
452 |
|
|
|
453 |
56091
|
argiro.kok
|
}
|
454 |
50169
|
argiro.kok
|
|
455 |
58275
|
k.triantaf
|
private numOfSearchResults(resultType: string, fetchClass: FetchResearchResults, refineParams) {
|
456 |
57084
|
konstantin
|
return this._searchResearchResultsService.numOfSearchResults(resultType, this.keyword, this.properties, refineParams).subscribe(
|
457 |
|
|
data => {
|
458 |
|
|
fetchClass.searchUtils.totalResults = data;
|
459 |
|
|
fetchClass.searchUtils.status = this.errorCodes.DONE;
|
460 |
|
|
if (fetchClass.searchUtils.totalResults == 0) {
|
461 |
|
|
fetchClass.searchUtils.status = this.errorCodes.NONE;
|
462 |
|
|
}
|
463 |
|
|
},
|
464 |
|
|
err => {
|
465 |
|
|
this.handleError("Error getting number of "+this.getEntityName(resultType, true, true), err);
|
466 |
|
|
fetchClass.searchUtils.status = this.errorCodes.ERROR;
|
467 |
|
|
}
|
468 |
|
|
);
|
469 |
|
|
}
|
470 |
|
|
|
471 |
56091
|
argiro.kok
|
private reloadTabs() {
|
472 |
|
|
this.reloadPublications = true;
|
473 |
|
|
this.reloadDatasets = true;
|
474 |
|
|
this.reloadSoftware = true;
|
475 |
|
|
this.reloadOrps = true;
|
476 |
|
|
this.reloadProjects = true;
|
477 |
|
|
this.reloadDataproviders = true;
|
478 |
|
|
this.reloadOrganizations = true;
|
479 |
|
|
this.fetchOrganizations.searchUtils.status = null;
|
480 |
|
|
this.fetchDataproviders.searchUtils.status = null;
|
481 |
|
|
this.fetchProjects.searchUtils.status = null;
|
482 |
|
|
this.fetchPublications.searchUtils.status = null;
|
483 |
|
|
this.fetchDatasets.searchUtils.status = null;
|
484 |
|
|
this.fetchSoftware.searchUtils.status = null;
|
485 |
|
|
this.fetchOrps.searchUtils.status = null;
|
486 |
|
|
}
|
487 |
50169
|
argiro.kok
|
|
488 |
56091
|
argiro.kok
|
private handleError(message: string, error) {
|
489 |
|
|
console.error("General Search Page: " + message, error);
|
490 |
|
|
}
|
491 |
57084
|
konstantin
|
|
492 |
|
|
private getEntityName (entityType:string, plural:boolean, full:boolean): string {
|
493 |
|
|
if(entityType == "publication") {
|
494 |
|
|
return "publication" + (plural ? "s" : "");
|
495 |
|
|
} else if(entityType == "dataset") {
|
496 |
|
|
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
|
497 |
|
|
} else if(entityType == "software") {
|
498 |
|
|
return "software";
|
499 |
|
|
} else if(entityType == "other") {
|
500 |
|
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
501 |
|
|
}
|
502 |
|
|
}
|
503 |
50169
|
argiro.kok
|
}
|