Project

General

Profile

« Previous | Next » 

Revision 58497

[Trunk | Library]:
1. entitiesAutoComplete.component.ts: [Bug fix] Add missing encoding in autocomplete term (problem when query uses cache).
2. newSearchPage.component.ts:
a. [Bug fix] Add missing keyword encoding for simple search form (problem when query uses cache).
b. [Bug fix] In advanced search, when "all fields" (field id="q") is added more than once in form, add both values (params "+=" and not "=" in "getSearchAPIQueryForAdvancedSearhField()" method).
3. searchAll.component.ts: Decode keyword parameter from url (to show it properly in search form).
4. searchAll.component.ts:
a. [Bug fix] Add missing encoding in search term, used by datacite, crossref and orcid search services (problem when query uses cache).
b. In methods of crossref service pass properties, instead of url - url will be built in service.
5. searchCrossref.service.ts:
a. In all methods, pass properties, instead of url.
b. Use cache when available.
6. ISVocabularies.service.ts: [Bug fix]: Return "accessMode.json" vocabulary when: entity == "result" (case added in if statement).

View differences:

searchCrossref.service.ts
4 4
import {HttpClient} from '@angular/common/http';
5 5
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
6 6
import {map} from "rxjs/operators";
7
import {EnvProperties} from "../../../utils/properties/env-properties";
7 8

  
8 9
@Injectable()
9 10
export class SearchCrossrefService {
10 11
  constructor( private http: HttpClient ) {}
11 12

  
12 13

  
13
  searchCrossrefResults(term: string, size: number, page: number, apiUrl: string, parse: boolean = false): any {
14
    let url = apiUrl + '?query=' + term + '&rows=' + size + '&offset=' + (size * (page - 1));
14
  searchCrossrefResults(term: string, size: number, page: number, properties: EnvProperties, parse: boolean = false): any {
15
    let url = properties.searchCrossrefAPIURL + '?query=' + term + '&rows=' + size + '&offset=' + (size * (page - 1));
15 16

  
16
     return this.http.get(url)
17
     return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
17 18
                     .pipe(map(request => request['message']))
18 19
                     .pipe(map(request => [request["total-results"], parse ? this.parse(request.items) : request]))
19 20
                     //.catch(this.handleError);
20 21

  
21 22
  }
22 23

  
23
  searchCrossrefByDOIs(DOIs: string[], apiUrl: string, parse: boolean = false): any {
24
  searchCrossrefByDOIs(DOIs: string[], properties: EnvProperties, parse: boolean = false): any {
24 25

  
25 26
    var doisParams = "";
26 27
    for (var i = 0; i < DOIs.length; i++) {
27 28
      doisParams += (doisParams.length > 0 ? "," : "") + 'doi:' + DOIs[i];
28 29
    }
29
    let url = apiUrl + '?filter=' + doisParams;
30
    let url = properties.searchCrossrefAPIURL + '?filter=' + doisParams;
30 31
           return this.http.get(url)
31 32
                       //.map(request => <any> request.json().message)
32 33
                       .pipe(map(request => request['message']))
33 34
                       .pipe(map(request => [request["total-results"], parse ? this.parse(request['items']) : request]))
34 35
                       //.catch(this.handleError);
35 36
}
36
  searchCrossrefByMultipleDOIs(dois: string[], apiUrl: string, parse: boolean = false): any {
37
    let url = apiUrl + '?filter=doi:';
37
  searchCrossrefByMultipleDOIs(dois: string[], properties: EnvProperties, parse: boolean = false): any {
38
    let url = properties.searchCrossrefAPIURL + '?filter=doi:';
38 39
    for (var i = 0; i < dois.length; i++) {
39 40
      url = url + (url.length == 0 ? '' : ',') + 'doi:' + dois[i];
40 41
    }
41
    url = apiUrl + '?filter=' + url;
42
    url = properties.searchCrossrefAPIURL + '?filter=' + url;
42 43
         return this.http.get(url)
43 44
                         //.map(request => <any> request.json().message)
44 45
                         .pipe(map(request => request['message']))

Also available in: Unified diff