change the query for community in search pages of pub/data/soft

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51871 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-04-26 12:20:32 +00:00
parent 1034bfa117
commit 39d92e32f6
4 changed files with 39 additions and 28 deletions

View File

@ -155,6 +155,10 @@ export class SearchPageComponent {
allFqs += fq;
}
}
if(this.connectCommunityId ){
allFqs+= "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
}
var keyword = params['keyword'];
var doiQuery = "";
var keywordQuery = "";
@ -202,6 +206,9 @@ export class SearchPageComponent {
}
}
if(this.connectCommunityId ){
allFqs+= "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
}
var keyword = params['keyword'];
var doiQuery = "";
var keywordQuery = "";
@ -285,19 +292,20 @@ export class SearchPageComponent {
if(filteredValues.length > 0){
filter.values = filteredValues;
}
}else if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
var filteredValues = [];
for(let filterValue of filter.values) {
if(this.connectCommunityId != filterValue.id){
filteredValues.push(filterValue);
}else{
filter.countSelectedValues-- ;
}
}
if(filteredValues.length > 0){
filter.values = filteredValues;
}
}
}
// else if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
// var filteredValues = [];
// for(let filterValue of filter.values) {
// if(this.connectCommunityId != filterValue.id){
// filteredValues.push(filterValue);
// }else{
// filter.countSelectedValues-- ;
// }
// }
// if(filteredValues.length > 0){
// filter.values = filteredValues;
// }
// }
}
return filters;
@ -321,15 +329,15 @@ export class SearchPageComponent {
for (let filter of filters){
var filterLimits="";
if(filter.countSelectedValues > 0 || (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
if(filter.countSelectedValues > 0 ){//|| (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
for (let value of filter.values){
if(value.selected == true){
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
}
}
if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(this.connectCommunityId)+'"';
}
// if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
// filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(this.connectCommunityId)+'"';
// }
this.queryParameters.set(filter.filterId,filterLimits);
if(filterLimits.length > 0){
this.parameterNames.push(filter.filterId);
@ -355,7 +363,7 @@ export class SearchPageComponent {
private createSearchQueryParameters(filters:Filter[]){ // called by goTo, result emited to and used by search find pages
var allFqs = "";
for (let filter of filters){
if(filter.countSelectedValues > 0 || (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
if(filter.countSelectedValues > 0 ){//|| (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
var fq = "";
var count_selected=0;
for (let value of filter.values){
@ -364,13 +372,16 @@ export class SearchPageComponent {
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
}
}
if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1){
count_selected++;
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId));
}
// if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1){
// count_selected++;
// fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId));
// }
fq="&fq="+fq;
allFqs += fq;
}
}
if(this.connectCommunityId ){
allFqs+= "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
}
//TODO --
var doiQuery = "";
@ -392,7 +403,6 @@ export class SearchPageComponent {
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
}
}
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
}

View File

@ -28,7 +28,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
searchFormClass="datasetsSearchForm"
[(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId
[piwikSiteId]=piwikSiteId
[(connectCommunityId)]=connectCommunityId >
</search-page>
`
@ -92,7 +92,7 @@ properties: EnvProperties;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchPage.connectCommunityId = this.connectCommunityId;
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);

View File

@ -31,7 +31,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
searchFormClass="publicationsSearchForm"
[(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId
[piwikSiteId]=piwikSiteId
[(connectCommunityId)]=connectCommunityId
>
</search-page>
@ -104,6 +104,7 @@ properties: EnvProperties;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchPage.connectCommunityId = this.connectCommunityId;
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});

View File

@ -28,7 +28,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
searchFormClass="softwareSearchForm"
[(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId
[piwikSiteId]=piwikSiteId
[(connectCommunityId)]=connectCommunityId >
</search-page>
`
@ -93,7 +93,7 @@ properties: EnvProperties;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchPage.connectCommunityId = this.connectCommunityId;
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);