Search/find

Add communityId 
	add community filter in search queries
advanced search - autocomplete
	add acronym and grant id in autocomplete for projects


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@53860 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-11-19 10:15:13 +00:00
parent 62f2c06fa8
commit f17d4735ea
15 changed files with 91 additions and 48 deletions

View File

@ -155,7 +155,7 @@
</search-result> </search-result>
</div> </div>
<div *ngIf = "keyword.length == 0 && activeTab=='publications'" class ="uk-animation-fade" > <div *ngIf = "keyword.length == 0 && activeTab=='publications'" class ="uk-animation-fade" >
<browse-entities [(properties)]=properties entityName="publication" baseUrl="/search/find/publications" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> <browse-entities [(properties)]=properties entityName="publication" baseUrl="/search/find/publications" [refineFields]=searchFields.RESULT_REFINE_FIELDS [connectCommunityId]=connectCommunityId ></browse-entities>
</div> </div>
<!--/li> <!--/li>
<li--> <li-->
@ -175,7 +175,7 @@
</search-result> </search-result>
</div> </div>
<div *ngIf = "keyword.length == 0 && activeTab=='research data'" class ="uk-animation-fade"> <div *ngIf = "keyword.length == 0 && activeTab=='research data'" class ="uk-animation-fade">
<browse-entities [(properties)]=properties entityName="dataset" baseUrl="/search/find/datasets" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> <browse-entities [(properties)]=properties entityName="dataset" baseUrl="/search/find/datasets" [refineFields]=searchFields.RESULT_REFINE_FIELDS [connectCommunityId]=connectCommunityId ></browse-entities>
</div> </div>
<!--/li> <!--/li>
<li--> <li-->
@ -194,7 +194,7 @@
</search-result> </search-result>
</div> </div>
<div *ngIf = "keyword.length == 0 && activeTab=='software'" class ="uk-animation-fade"> <div *ngIf = "keyword.length == 0 && activeTab=='software'" class ="uk-animation-fade">
<browse-entities [(properties)]=properties entityName="software" baseUrl="/search/find/software" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> <browse-entities [(properties)]=properties entityName="software" baseUrl="/search/find/software" [refineFields]=searchFields.RESULT_REFINE_FIELDS [connectCommunityId]=connectCommunityId ></browse-entities>
</div> </div>
<!--/li> <!--/li>
<li--> <li-->
@ -213,7 +213,7 @@
</search-result> </search-result>
</div> </div>
<div *ngIf = "keyword.length == 0 && activeTab=='other research products'" class ="uk-animation-fade"> <div *ngIf = "keyword.length == 0 && activeTab=='other research products'" class ="uk-animation-fade">
<browse-entities [(properties)]=properties entityName="other" baseUrl="/search/find/other" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> <browse-entities [(properties)]=properties entityName="other" baseUrl="/search/find/other" [refineFields]=searchFields.RESULT_REFINE_FIELDS [connectCommunityId]=connectCommunityId ></browse-entities>
</div> </div>
<!--/li> <!--/li>
<li--> <li-->

View File

@ -32,6 +32,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
import {ConfigurationService} from '../../utils/configuration/configuration.service'; import {ConfigurationService} from '../../utils/configuration/configuration.service';
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import { SEOService } from '../../sharedComponents/SEO/SEO.service'; import { SEOService } from '../../sharedComponents/SEO/SEO.service';
import {StringUtils} from '../../utils/string-utils.class';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.Default, changeDetection: ChangeDetectionStrategy.Default,
@ -99,6 +100,8 @@ export class SearchComponent {
properties: EnvProperties; properties: EnvProperties;
@Input() logoURL; @Input() logoURL;
@Input() name; @Input() name;
@Input() connectCommunityId =null;
@Input() piwikSiteId = null;
public subPub;public subData; public subSoftware; public subOrps; public subProjects;public subOrg; public subDataPr; public subPub;public subData; public subSoftware; public subOrps; public subProjects;public subOrg; public subDataPr;
constructor ( private route: ActivatedRoute, constructor ( private route: ActivatedRoute,
@ -142,13 +145,13 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this._meta.updateTag({content:url},"property='og:url'"); this._meta.updateTag({content:url},"property='og:url'");
this.seoService.createLinkForCanonicalURL(false); this.seoService.createLinkForCanonicalURL(false);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...").subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe();
} }
this.config.getCommunityInformation(this.properties.adminToolsAPIURL, this.properties.adminToolsCommunity ).subscribe(data => { this.config.getCommunityInformation(this.properties.adminToolsAPIURL, (this.connectCommunityId)?this.connectCommunityId:this.properties.adminToolsCommunity ).subscribe(data => {
var showEntity = {}; var showEntity = {};
for(var i=0; i< data.entities.length; i++){ for(var i=0; i< data.entities.length; i++){
@ -161,12 +164,17 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.showDataProviders = showEntity["datasource"]; this.showDataProviders = showEntity["datasource"];
this.showSoftware = showEntity["software"]; this.showSoftware = showEntity["software"];
this.showOrps = showEntity["orp"]; this.showOrps = showEntity["orp"];
if(this.connectCommunityId){
this.showProjects = false;
this.showOrganizations = false;
this.showDataProviders = false;
}
this.sub = this.route.queryParams.subscribe(params => { this.sub = this.route.queryParams.subscribe(params => {
this.reloadTabs();
this.keyword = (params['keyword'])?params['keyword']:""; this.keyword = (params['keyword'])?params['keyword']:"";
if(this.keyword !=null && this.keyword.length > 0){ if(this.keyword !=null && this.keyword.length > 0){
this.reloadTabs();
//if showPublications == false will set another entity as the first //if showPublications == false will set another entity as the first
if(this.showPublications){ if(this.showPublications){
this.activeTab = "publications"; this.activeTab = "publications";
@ -236,10 +244,10 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "publications"; this.activeTab = "publications";
this.advancedSearchLink ="/search/advanced/publications"; this.advancedSearchLink ="/search/advanced/publications";
if( this.reloadPublications && if( this.reloadPublications &&
this.fetchPublications.searchUtils.status != this.errorCodes.NONE && this.fetchPublications.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR) { this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadPublications = false; this.reloadPublications = false;
this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId);
this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword; this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword;
} }
} }
@ -247,10 +255,10 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "research data"; this.activeTab = "research data";
this.advancedSearchLink ="/search/advanced/datasets"; this.advancedSearchLink ="/search/advanced/datasets";
if(this.reloadDatasets && if(this.reloadDatasets &&
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE && this.fetchDatasets.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR) { this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadDatasets = false; this.reloadDatasets = false;
this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId);
this.linkToSearchDatasets =this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword; this.linkToSearchDatasets =this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword;
} }
} }
@ -259,11 +267,12 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "software"; this.activeTab = "software";
this.advancedSearchLink ="/search/advanced/software"; this.advancedSearchLink ="/search/advanced/software";
if(this.reloadSoftware && if(this.reloadSoftware
&& this.fetchSoftware.searchUtils.status != this.errorCodes.NONE/* &&
( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || ( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )) { this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/) {
this.reloadSoftware = false; this.reloadSoftware = false;
this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId);
this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword; this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword;
} }
} }
@ -272,10 +281,10 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "other research products"; this.activeTab = "other research products";
this.advancedSearchLink ="/search/advanced/other"; this.advancedSearchLink ="/search/advanced/other";
if(this.reloadOrps && if(this.reloadOrps &&
this.fetchOrps.searchUtils.status != this.errorCodes.NONE && this.fetchOrps.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchOrps.searchUtils.status != this.errorCodes.ERROR) { this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadOrps = false; this.reloadOrps = false;
this.fetchOrps.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchOrps.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId);
this.linkToSearchOrps =this.properties.searchLinkToOrps; this.linkToSearchOrps =this.properties.searchLinkToOrps;
} }
} }
@ -283,8 +292,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "projects"; this.activeTab = "projects";
this.advancedSearchLink ="/search/advanced/projects"; this.advancedSearchLink ="/search/advanced/projects";
if(this.reloadProjects && if(this.reloadProjects &&
this.fetchProjects.searchUtils.status != this.errorCodes.NONE && this.fetchProjects.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchProjects.searchUtils.status != this.errorCodes.ERROR) { this.fetchProjects.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadProjects = false; this.reloadProjects = false;
this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10,this.properties);
this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword; this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword;
@ -294,8 +303,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "content providers"; this.activeTab = "content providers";
this.advancedSearchLink ="/search/advanced/dataproviders"; this.advancedSearchLink ="/search/advanced/dataproviders";
if( this.reloadDataproviders && if( this.reloadDataproviders &&
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE && this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR) { this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadDataproviders = false; this.reloadDataproviders = false;
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10,this.properties);
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword; this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword;
@ -305,8 +314,8 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.activeTab = "organizations"; this.activeTab = "organizations";
this.advancedSearchLink ="/search/advanced/organizations"; this.advancedSearchLink ="/search/advanced/organizations";
if( this.reloadOrganizations && if( this.reloadOrganizations &&
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE && this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR) { this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadOrganizations = false; this.reloadOrganizations = false;
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10,this.properties); this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10,this.properties);
this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword; this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword;
@ -346,10 +355,12 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
} }
private count() { private count() {
var refineParams = this.connectCommunityId?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((this.connectCommunityId )))):null;
if(this.activeTab != "publications" && this.showPublications){ if(this.activeTab != "publications" && this.showPublications){
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING; this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
this.fetchPublications.results = []; this.fetchPublications.results = [];
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword,this.properties).subscribe(
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword,this.properties, refineParams).subscribe(
data => { data => {
console.log("Count results: "+data); console.log("Count results: "+data);
this.fetchPublications.searchUtils.totalResults = data; this.fetchPublications.searchUtils.totalResults = data;
@ -367,7 +378,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
if(this.activeTab != "research data" && this.showDatasets){ if(this.activeTab != "research data" && this.showDatasets){
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING; this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
this.fetchDatasets.results = []; this.fetchDatasets.results = [];
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword,this.properties).subscribe( this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword,this.properties, refineParams).subscribe(
data => { data => {
this.fetchDatasets.searchUtils.totalResults = data; this.fetchDatasets.searchUtils.totalResults = data;
this.fetchDatasets.searchUtils.status = this.errorCodes.DONE; this.fetchDatasets.searchUtils.status = this.errorCodes.DONE;
@ -384,7 +395,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
if(this.activeTab != "software" && this.showSoftware){ if(this.activeTab != "software" && this.showSoftware){
this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING; this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING;
this.fetchSoftware.results = []; this.fetchSoftware.results = [];
this.subSoftware = this._searchSoftwareService.numOfSearchSoftware(this.keyword,this.properties).subscribe( this.subSoftware = this._searchSoftwareService.numOfSearchSoftware(this.keyword,this.properties, refineParams).subscribe(
data => { data => {
this.fetchSoftware.searchUtils.totalResults = data; this.fetchSoftware.searchUtils.totalResults = data;
this.fetchSoftware.searchUtils.status = this.errorCodes.DONE; this.fetchSoftware.searchUtils.status = this.errorCodes.DONE;
@ -408,7 +419,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
if(this.activeTab != "other research products" && this.showOrps){ if(this.activeTab != "other research products" && this.showOrps){
this.fetchOrps.searchUtils.status = this.errorCodes.LOADING; this.fetchOrps.searchUtils.status = this.errorCodes.LOADING;
this.fetchOrps.results = []; this.fetchOrps.results = [];
this.subOrps = this._searchOrpsService.numOfSearchOrps(this.keyword,this.properties).subscribe( this.subOrps = this._searchOrpsService.numOfSearchOrps(this.keyword,this.properties, refineParams).subscribe(
data => { data => {
this.fetchOrps.searchUtils.totalResults = data; this.fetchOrps.searchUtils.totalResults = data;
this.fetchOrps.searchUtils.status = this.errorCodes.DONE; this.fetchOrps.searchUtils.status = this.errorCodes.DONE;
@ -473,6 +484,13 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj
this.reloadProjects = true; this.reloadProjects = true;
this.reloadDataproviders = true; this.reloadDataproviders = true;
this.reloadOrganizations = true; this.reloadOrganizations = true;
this.fetchOrganizations.searchUtils.status = null;
this.fetchDataproviders.searchUtils.status = null;
this.fetchProjects.searchUtils.status = null;
this.fetchPublications.searchUtils.status = null;
this.fetchDatasets.searchUtils.status = null;
this.fetchSoftware.searchUtils.status = null;
this.fetchOrps.searchUtils.status = null;
} }

View File

@ -10,6 +10,7 @@ import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass} from '../searchUtils/searchUtils.class'; import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties'; import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class';
@Component({ @Component({
selector: 'browse-entities', selector: 'browse-entities',
@ -38,6 +39,8 @@ export class BrowseEntitiesComponent {
@Input() public entityName:string = ""; @Input() public entityName:string = "";
@Input() public refineFields: string[] ;//= this.searchFields.RESULT_REFINE_FIELDS; @Input() public refineFields: string[] ;//= this.searchFields.RESULT_REFINE_FIELDS;
@Input() properties:EnvProperties; @Input() properties:EnvProperties;
@Input() connectCommunityId =null;
public sub: any; public sub: any;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
public status = this.errorCodes.LOADING; public status = this.errorCodes.LOADING;
@ -68,7 +71,9 @@ export class BrowseEntitiesComponent {
private getStats(){ private getStats(){
this.status = this.errorCodes.LOADING; this.status = this.errorCodes.LOADING;
this.sub = this._refineFieldsService.getRefineFieldsResultsByEntityName(this.refineFields,this.entityName, this.properties).subscribe( var refineParams = this.connectCommunityId?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((this.connectCommunityId )))):null;
this.sub = this._refineFieldsService.getRefineFieldsResultsByEntityName(this.refineFields,this.entityName, this.properties,refineParams).subscribe(
data => { data => {
console.info("Get Stats for "+this.entityName+ ": [Total:"+data[0]+" ] [fields: "+data[1].length+"]"); console.info("Get Stats for "+this.entityName+ ": [Total:"+data[0]+" ] [fields: "+data[1].length+"]");
this.filters = data[1]; this.filters = data[1];

View File

@ -11,11 +11,14 @@ import{EnvProperties} from '../utils/properties/env-properties';
@Injectable() @Injectable()
export class RefineFieldResultsService { export class RefineFieldResultsService {
constructor(private http: Http ) {} constructor(private http: Http ) {}
getRefineFieldsResultsByEntityName(fields:string[], entityName:string, properties:EnvProperties):any{ getRefineFieldsResultsByEntityName(fields:string[], entityName:string, properties:EnvProperties, communityQuery=null):any{
let url = properties.searchAPIURLLAst + this.getSearchAPIURLForEntity(entityName)+"?format=json&refine=true&page=1&size=0"; let url = properties.searchAPIURLLAst + this.getSearchAPIURLForEntity(entityName)+"?format=json&refine=true&page=1&size=0";
for(var i=0; i < fields.length; i++){ for(var i=0; i < fields.length; i++){
url += "&fields="+fields[i]; url += "&fields="+fields[i];
} }
if(communityQuery!= null && communityQuery != '' ) {
url += communityQuery;
}
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())

View File

@ -351,11 +351,14 @@ export class SearchDatasetsService {
return this.numOfDatasets(url, properties); return this.numOfDatasets(url, properties);
} }
numOfSearchDatasets(params: string, properties:EnvProperties):any { numOfSearchDatasets(params: string, properties:EnvProperties, refineParams:string=null):any {
let url = properties.searchAPIURLLAst+"datasets/count?format=json"; let url = properties.searchAPIURLLAst+"datasets/count?format=json";
if(params != "") { if(params != "") {
url += "&q=" + StringUtils.URIEncode(params); url += "&q=" + StringUtils.URIEncode(params);
} }
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
return this.numOfDatasets(url, properties); return this.numOfDatasets(url, properties);
} }
} }

View File

@ -355,12 +355,15 @@ export class SearchOrpsService {
return this.numOfOrps(url, properties); return this.numOfOrps(url, properties);
} }
numOfSearchOrps(params: string, properties:EnvProperties):any { numOfSearchOrps(params: string, properties:EnvProperties, refineParams:string=null):any {
let url = properties.searchAPIURLLAst+"other/count?format=json"; let url = properties.searchAPIURLLAst+"other/count?format=json";
if(params != "") { if(params != "") {
url += "&q=" + StringUtils.URIEncode(params); url += "&q=" + StringUtils.URIEncode(params);
} }
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
return this.numOfOrps(url, properties); return this.numOfOrps(url, properties);
} }
} }

View File

@ -465,11 +465,14 @@ export class SearchPublicationsService {
return this.numOfPublications(url, properties); return this.numOfPublications(url, properties);
} }
numOfSearchPublications(params: string, properties:EnvProperties):any { numOfSearchPublications(params: string, properties:EnvProperties, refineParams:string=null):any {
let url = properties.searchAPIURLLAst+"publications/count?format=json"; let url = properties.searchAPIURLLAst+"publications/count?format=json";
if(params != "") { if(params != "") {
url += "&q=" + StringUtils.URIEncode(params); url += "&q=" + StringUtils.URIEncode(params);
} }
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
return this.numOfPublications(url, properties); return this.numOfPublications(url, properties);
} }
/* /*

View File

@ -366,11 +366,14 @@ export class SearchSoftwareService {
return this.numOfSoftware(url, properties); return this.numOfSoftware(url, properties);
} }
numOfSearchSoftware(params: string, properties:EnvProperties):any { numOfSearchSoftware(params: string, properties:EnvProperties, refineParams:string=null):any {
let url = properties.searchAPIURLLAst+"software/count?format=json"; let url = properties.searchAPIURLLAst+"software/count?format=json";
if(params != "") { if(params != "") {
url += "&q=" + StringUtils.URIEncode(params); url += "&q=" + StringUtils.URIEncode(params);
} }
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
return this.numOfSoftware(url, properties); return this.numOfSoftware(url, properties);
} }
} }

View File

@ -5,7 +5,6 @@ import { JsonldDocumentSerializerService } from './service/jsonld-document-seria
selector: 'schema2jsonld', selector: 'schema2jsonld',
template: ` template: `
<ngx-json-ld [json]="json"></ngx-json-ld> <ngx-json-ld [json]="json"></ngx-json-ld>
{{json|json}}
` `
}) })
export class Schema2jsonldComponent { export class Schema2jsonldComponent {

View File

@ -235,8 +235,10 @@ export class EntitiesAutocompleteComponent {
} }
showItem(item:any):string{ showItem(item:any):string{
console.log(item);
if (item.name){ //search if (item.projectName || item.projectAcronym || item.code){ //project
return ((item.projectAcronym)?"["+item.projectAcronym+"] ":"")+item.projectName+((item.code)?" ("+item.code+")":"");
}else if (item.name){ //search
return item.name; return item.name;
}else if( item.concept && item.concept.label){ //context }else if( item.concept && item.concept.label){ //context
return item.concept.label; return item.concept.label;

View File

@ -37,7 +37,7 @@ export class FetchDatasets{
} }
public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties){ public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties, connectCommunityId=null){
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){
var DOIs:string[] = DOI.getDOIsFromString(keyword); var DOIs:string[] = DOI.getDOIsFromString(keyword);
@ -55,8 +55,9 @@ export class FetchDatasets{
//var errorCodes:ErrorCodes = new ErrorCodes(); //var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
var refineParams = (connectCommunityId)?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((connectCommunityId )))):null;
this.subResults = this._searchDatasetsService.searchDatasets(parameters,null, page, size, [], properties).subscribe( this.subResults = this._searchDatasetsService.searchDatasets(parameters,refineParams, page, size, [], properties).subscribe(
data => { data => {
this.searchUtils.totalResults = data[0]; this.searchUtils.totalResults = data[0];
console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -38,7 +38,7 @@ export class FetchOrps{
} }
public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties){ public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties, connectCommunityId=null){
console.info("orps: getResultsByKeyword"); console.info("orps: getResultsByKeyword");
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){
@ -56,8 +56,8 @@ export class FetchOrps{
} }
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
var refineParams = (connectCommunityId)?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((connectCommunityId )))):null;
this.subResults = this._searchOrpsService.searchOrps(parameters,null, page, size, [], properties).subscribe( this.subResults = this._searchOrpsService.searchOrps(parameters,refineParams, page, size, [], properties).subscribe(
data => { data => {
this.searchUtils.totalResults = data[0]; this.searchUtils.totalResults = data[0];
console.info("search Other Research Products: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); console.info("search Other Research Products: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -49,7 +49,7 @@ export class FetchPublications {
} }
} }
public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties){ public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties, connectCommunityId=null){
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){
var DOIs:string[] = DOI.getDOIsFromString(keyword); var DOIs:string[] = DOI.getDOIsFromString(keyword);
@ -68,8 +68,8 @@ export class FetchPublications {
//var errorCodes:ErrorCodes = new ErrorCodes(); //var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
var refineParams = (connectCommunityId)?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((connectCommunityId )))):null;
this.subResults = this._searchPublicationsService.searchPublications(parameters,null, page, size, [], properties).subscribe( this.subResults = this._searchPublicationsService.searchPublications(parameters,refineParams, page, size, [], properties).subscribe(
data => { data => {
this.searchUtils.totalResults = data[0]; this.searchUtils.totalResults = data[0];
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -38,7 +38,7 @@ export class FetchSoftware{
} }
public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties){ public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties, connectCommunityId=null){
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){
var DOIs:string[] = DOI.getDOIsFromString(keyword); var DOIs:string[] = DOI.getDOIsFromString(keyword);
@ -56,8 +56,9 @@ export class FetchSoftware{
//var errorCodes:ErrorCodes = new ErrorCodes(); //var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
var refineParams = (connectCommunityId)?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((connectCommunityId )))):null;
this.subResults = this._searchSoftwareService.searchSoftware(parameters,null, page, size, [], properties).subscribe( this.subResults = this._searchSoftwareService.searchSoftware(parameters,refineParams, page, size, [], properties).subscribe(
data => { data => {
this.searchUtils.totalResults = data[0]; this.searchUtils.totalResults = data[0];
console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -19,6 +19,8 @@ export class PiwikService {
var ua = this.getUserAgent(); var ua = this.getUserAgent();
var referrer = this.getReferrer(); var referrer = this.getReferrer();
console.log("Piwik - id: " + siteId);
if(typeof location !== 'undefined'){ if(typeof location !== 'undefined'){
var url = properties.piwikBaseUrl+((siteId!=null)?siteId:properties.piwikSiteId)+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+ var url = properties.piwikBaseUrl+((siteId!=null)?siteId:properties.piwikSiteId)+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+
((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+ ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+