Project

General

Profile

« Previous | Next » 

Revision 51871

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

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchPage.component.ts
155 155
             allFqs += fq;
156 156
          }
157 157
   }
158
   if(this.connectCommunityId ){
159
     allFqs+=  "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
160
   }
161

  
158 162
   var keyword = params['keyword'];
159 163
   var doiQuery = "";
160 164
   var keywordQuery = "";
......
202 206
        }
203 207

  
204 208
  }
209
  if(this.connectCommunityId ){
210
    allFqs+=  "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
211
  }
205 212
  var keyword = params['keyword'];
206 213
  var doiQuery = "";
207 214
  var keywordQuery = "";
......
285 292
               if(filteredValues.length > 0){
286 293
                 filter.values = filteredValues;
287 294
               }
288
             }else if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
289
               var filteredValues = [];
290
               for(let filterValue of filter.values) {
291
                 if(this.connectCommunityId != filterValue.id){
292
                     filteredValues.push(filterValue);
293
                 }else{
294
                   filter.countSelectedValues-- ;
295
                 }
296
               }
297
               if(filteredValues.length > 0){
298
                 filter.values = filteredValues;
299
               }
300
         }
295
             }
296
        //      else if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
297
        //        var filteredValues = [];
298
        //        for(let filterValue of filter.values) {
299
        //          if(this.connectCommunityId != filterValue.id){
300
        //              filteredValues.push(filterValue);
301
        //          }else{
302
        //            filter.countSelectedValues-- ;
303
        //          }
304
        //        }
305
        //        if(filteredValues.length > 0){
306
        //          filter.values = filteredValues;
307
        //        }
308
        //  }
301 309
       }
302 310

  
303 311
         return filters;
......
321 329

  
322 330
    for (let filter of filters){
323 331
      var filterLimits="";
324
      if(filter.countSelectedValues > 0 || (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
332
      if(filter.countSelectedValues > 0 ){//|| (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
325 333
        for (let value of filter.values){
326 334
          if(value.selected == true){
327 335
            filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
328 336
          }
329 337
        }
330
        if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
331
          filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(this.connectCommunityId)+'"';
332
        }
338
        // if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1 ){
339
        //   filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(this.connectCommunityId)+'"';
340
        // }
333 341
        this.queryParameters.set(filter.filterId,filterLimits);
334 342
        if(filterLimits.length > 0){
335 343
          this.parameterNames.push(filter.filterId);
......
355 363
  private createSearchQueryParameters(filters:Filter[]){   // called by goTo, result emited to and used by search find pages
356 364
    var allFqs = "";
357 365
    for (let filter of filters){
358
      if(filter.countSelectedValues > 0 || (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
366
      if(filter.countSelectedValues > 0 ){//|| (this.connectCommunityId && filter.filterId.indexOf("community")!=-1)){
359 367
        var fq = "";
360 368
        var count_selected=0;
361 369
        for (let value of filter.values){
......
364 372
              fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId +  " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
365 373
           }
366 374
        }
367
        if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1){
368
          count_selected++;
369
          fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId +  " exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId));
370
        }
375
        // if(this.connectCommunityId && filter.filterId.indexOf("community")!=-1){
376
        //   count_selected++;
377
        //   fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId +  " exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId));
378
        // }
371 379
        fq="&fq="+fq;
372 380
        allFqs += fq;
373 381
      }
374 382
    }
383
    if(this.connectCommunityId ){
384
      allFqs+=  "&fq=communityId exact " + StringUtils.quote(StringUtils.URIEncode(this.connectCommunityId ));
385
    }
375 386
      //TODO --
376 387
    var doiQuery = "";
377 388
    var keywordQuery = "";
......
392 403
           keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
393 404
      }
394 405
    }
395

  
396 406
    return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
397 407

  
398 408
  }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/simple/searchDatasets.component.ts
28 28
                 searchFormClass="datasetsSearchForm"
29 29
                 [(openaireLink)]=openaireLink
30 30
                 [(advancedSearchParameters)]=advancedSearchParameters
31
                 [piwikSiteId]=piwikSiteId 
31
                 [piwikSiteId]=piwikSiteId
32 32
                 [(connectCommunityId)]=connectCommunityId >
33 33
    </search-page>
34 34
    `
......
92 92
      }
93 93
      firstLoad = false;
94 94
      this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
95

  
95
      this.searchPage.connectCommunityId = this.connectCommunityId;
96 96
      var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
97 97
       this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
98 98

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/simple/searchSoftware.component.ts
28 28
                 searchFormClass="softwareSearchForm"
29 29
                 [(openaireLink)]=openaireLink
30 30
                 [(advancedSearchParameters)]=advancedSearchParameters
31
                 [piwikSiteId]=piwikSiteId 
31
                 [piwikSiteId]=piwikSiteId
32 32
                 [(connectCommunityId)]=connectCommunityId >
33 33
    </search-page>
34 34
    `
......
93 93
      }
94 94
      firstLoad = false;
95 95
      this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
96

  
96
      this.searchPage.connectCommunityId = this.connectCommunityId;
97 97
      var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
98 98
       this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
99 99

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/simple/searchPublications.component.ts
31 31
                 searchFormClass="publicationsSearchForm"
32 32
                 [(openaireLink)]=openaireLink
33 33
                 [(advancedSearchParameters)]=advancedSearchParameters
34
                  [piwikSiteId]=piwikSiteId 
34
                  [piwikSiteId]=piwikSiteId
35 35
                 [(connectCommunityId)]=connectCommunityId
36 36
                 >
37 37
    </search-page>
......
104 104
        }
105 105
        firstLoad = false;
106 106
        this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
107
        this.searchPage.connectCommunityId = this.connectCommunityId;
107 108
        var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
108 109
        this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
109 110
    });

Also available in: Unified diff