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:
parent
1034bfa117
commit
39d92e32f6
|
@ -155,6 +155,10 @@ export class SearchPageComponent {
|
||||||
allFqs += fq;
|
allFqs += fq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this.connectCommunityId ){
|
||||||
|
allFqs+= "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
|
||||||
|
}
|
||||||
|
|
||||||
var keyword = params['keyword'];
|
var keyword = params['keyword'];
|
||||||
var doiQuery = "";
|
var doiQuery = "";
|
||||||
var keywordQuery = "";
|
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 keyword = params['keyword'];
|
||||||
var doiQuery = "";
|
var doiQuery = "";
|
||||||
var keywordQuery = "";
|
var keywordQuery = "";
|
||||||
|
@ -285,19 +292,20 @@ export class SearchPageComponent {
|
||||||
if(filteredValues.length > 0){
|
if(filteredValues.length > 0){
|
||||||
filter.values = filteredValues;
|
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;
|
return filters;
|
||||||
|
@ -321,15 +329,15 @@ export class SearchPageComponent {
|
||||||
|
|
||||||
for (let filter of filters){
|
for (let filter of filters){
|
||||||
var filterLimits="";
|
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){
|
for (let value of filter.values){
|
||||||
if(value.selected == true){
|
if(value.selected == true){
|
||||||
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
|
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
|
// if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
|
||||||
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(this.connectCommunityId)+'"';
|
// filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(this.connectCommunityId)+'"';
|
||||||
}
|
// }
|
||||||
this.queryParameters.set(filter.filterId,filterLimits);
|
this.queryParameters.set(filter.filterId,filterLimits);
|
||||||
if(filterLimits.length > 0){
|
if(filterLimits.length > 0){
|
||||||
this.parameterNames.push(filter.filterId);
|
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
|
private createSearchQueryParameters(filters:Filter[]){ // called by goTo, result emited to and used by search find pages
|
||||||
var allFqs = "";
|
var allFqs = "";
|
||||||
for (let filter of filters){
|
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 fq = "";
|
||||||
var count_selected=0;
|
var count_selected=0;
|
||||||
for (let value of filter.values){
|
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));
|
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1){
|
// if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1){
|
||||||
count_selected++;
|
// count_selected++;
|
||||||
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId));
|
// fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId));
|
||||||
}
|
// }
|
||||||
fq="&fq="+fq;
|
fq="&fq="+fq;
|
||||||
allFqs += fq;
|
allFqs += fq;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(this.connectCommunityId ){
|
||||||
|
allFqs+= "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
|
||||||
}
|
}
|
||||||
//TODO --
|
//TODO --
|
||||||
var doiQuery = "";
|
var doiQuery = "";
|
||||||
|
@ -392,7 +403,6 @@ export class SearchPageComponent {
|
||||||
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
|
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ properties: EnvProperties;
|
||||||
}
|
}
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
this.searchPage.connectCommunityId = this.connectCommunityId;
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||||
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ properties: EnvProperties;
|
||||||
}
|
}
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
this.searchPage.connectCommunityId = this.connectCommunityId;
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||||
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,7 +93,7 @@ properties: EnvProperties;
|
||||||
}
|
}
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
this.searchPage.connectCommunityId = this.connectCommunityId;
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||||
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue