[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). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58497 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
5ab6ff142f
commit
5bdb42f471
|
@ -180,14 +180,14 @@ export class ClaimResultSearchFormComponent {
|
|||
this.crossrefStatus = this.errorCodes.LOADING;
|
||||
// this.crossrefResultsNum = null;
|
||||
if (this.DOIs.length > 0) {
|
||||
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs, this.properties, true).subscribe(
|
||||
data => {
|
||||
if (data != null) {
|
||||
this.crossrefResults = data[1];
|
||||
this.crossrefPage = page;
|
||||
this.crossrefResultsNum = data[0];
|
||||
if (this.crossrefResultsNum == 0) {
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||
this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
|
||||
data => {
|
||||
if (data != null) {
|
||||
this.crossrefResults = data[1];
|
||||
|
@ -217,7 +217,7 @@ export class ClaimResultSearchFormComponent {
|
|||
err => {
|
||||
ClaimResultSearchFormComponent.handleError("Error getting crossref by DOIs: " + JSON.stringify(this.DOIs), err);
|
||||
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||
this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
|
||||
data => {
|
||||
this.crossrefResults = data[1];
|
||||
this.crossrefPage = page;
|
||||
|
@ -237,7 +237,7 @@ export class ClaimResultSearchFormComponent {
|
|||
} else {
|
||||
|
||||
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||
this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
|
||||
data => {
|
||||
if (data != null) {
|
||||
this.crossrefResults = data[1];
|
||||
|
@ -374,7 +374,7 @@ export class ClaimResultSearchFormComponent {
|
|||
private getOrcidAuthor(term: string, addId) {
|
||||
this.orcidResultsNum = null;
|
||||
//passing structures in order to fill them in service
|
||||
this._searchOrcidService.searchOrcidAuthor(term.replace(/\s/g, ""), this.authorIds,
|
||||
this._searchOrcidService.searchOrcidAuthor(StringUtils.URIEncode(term.replace(/\s/g, "")), this.authorIds,
|
||||
this.authors, this.properties, addId).subscribe(
|
||||
data => {
|
||||
if (data != null && data == true && addId) {
|
||||
|
@ -404,7 +404,7 @@ export class ClaimResultSearchFormComponent {
|
|||
this.selectAuthorId = "0";
|
||||
this.orcidStatus = this.errorCodes.LOADING;
|
||||
//passing structures in order to fill them in service
|
||||
this._searchOrcidService.searchOrcidAuthors(term, this.properties).subscribe(
|
||||
this._searchOrcidService.searchOrcidAuthors(StringUtils.URIEncode(term), this.properties).subscribe(
|
||||
data => {
|
||||
this.authorIds = data;
|
||||
if (data != null) {
|
||||
|
@ -490,7 +490,7 @@ export class ClaimResultSearchFormComponent {
|
|||
private enhanceInfoFromDOI(entity: ClaimEntity) {
|
||||
|
||||
if (entity.result.DOI != null) {
|
||||
this._searchCrossrefService.searchCrossrefByDOIs([entity.result.DOI], this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||
this._searchCrossrefService.searchCrossrefByDOIs([entity.result.DOI], this.properties, true).subscribe(
|
||||
data => {
|
||||
if (data != null && data[0] > 0 && data[1]) {
|
||||
let crossrefResult: ClaimEntity = data[1][0];
|
||||
|
@ -661,7 +661,7 @@ export class ClaimResultSearchFormComponent {
|
|||
this.dataciteResultsNum = this.dataciteResults.length;
|
||||
this.dataciteStatus = this.errorCodes.DONE;
|
||||
if (this.dataciteResultsNum == 0) {
|
||||
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties, true).subscribe(
|
||||
this._searchDataciteService.searchDataciteResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
|
||||
data => {
|
||||
this.dataciteResults = data[1];
|
||||
this.datacitePage = page;
|
||||
|
@ -686,7 +686,7 @@ export class ClaimResultSearchFormComponent {
|
|||
} else {
|
||||
|
||||
|
||||
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties, true).subscribe(
|
||||
this._searchDataciteService.searchDataciteResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
|
||||
data => {
|
||||
this.dataciteResults = data[1];
|
||||
this.datacitePage = page;
|
||||
|
|
|
@ -4,41 +4,42 @@ import {Response} from '@angular/http';
|
|||
import {HttpClient} from '@angular/common/http';
|
||||
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
|
||||
import {map} from "rxjs/operators";
|
||||
import {EnvProperties} from "../../../utils/properties/env-properties";
|
||||
|
||||
@Injectable()
|
||||
export class SearchCrossrefService {
|
||||
constructor( private http: HttpClient ) {}
|
||||
|
||||
|
||||
searchCrossrefResults(term: string, size: number, page: number, apiUrl: string, parse: boolean = false): any {
|
||||
let url = apiUrl + '?query=' + term + '&rows=' + size + '&offset=' + (size * (page - 1));
|
||||
searchCrossrefResults(term: string, size: number, page: number, properties: EnvProperties, parse: boolean = false): any {
|
||||
let url = properties.searchCrossrefAPIURL + '?query=' + term + '&rows=' + size + '&offset=' + (size * (page - 1));
|
||||
|
||||
return this.http.get(url)
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(request => request['message']))
|
||||
.pipe(map(request => [request["total-results"], parse ? this.parse(request.items) : request]))
|
||||
//.catch(this.handleError);
|
||||
|
||||
}
|
||||
|
||||
searchCrossrefByDOIs(DOIs: string[], apiUrl: string, parse: boolean = false): any {
|
||||
searchCrossrefByDOIs(DOIs: string[], properties: EnvProperties, parse: boolean = false): any {
|
||||
|
||||
var doisParams = "";
|
||||
for (var i = 0; i < DOIs.length; i++) {
|
||||
doisParams += (doisParams.length > 0 ? "," : "") + 'doi:' + DOIs[i];
|
||||
}
|
||||
let url = apiUrl + '?filter=' + doisParams;
|
||||
let url = properties.searchCrossrefAPIURL + '?filter=' + doisParams;
|
||||
return this.http.get(url)
|
||||
//.map(request => <any> request.json().message)
|
||||
.pipe(map(request => request['message']))
|
||||
.pipe(map(request => [request["total-results"], parse ? this.parse(request['items']) : request]))
|
||||
//.catch(this.handleError);
|
||||
}
|
||||
searchCrossrefByMultipleDOIs(dois: string[], apiUrl: string, parse: boolean = false): any {
|
||||
let url = apiUrl + '?filter=doi:';
|
||||
searchCrossrefByMultipleDOIs(dois: string[], properties: EnvProperties, parse: boolean = false): any {
|
||||
let url = properties.searchCrossrefAPIURL + '?filter=doi:';
|
||||
for (var i = 0; i < dois.length; i++) {
|
||||
url = url + (url.length == 0 ? '' : ',') + 'doi:' + dois[i];
|
||||
}
|
||||
url = apiUrl + '?filter=' + url;
|
||||
url = properties.searchCrossrefAPIURL + '?filter=' + url;
|
||||
return this.http.get(url)
|
||||
//.map(request => <any> request.json().message)
|
||||
.pipe(map(request => request['message']))
|
||||
|
|
|
@ -213,7 +213,7 @@ export class SearchAllComponent {
|
|||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.parameters = Object.assign({}, params);
|
||||
this.keyword = (params['keyword']) ? params['keyword'] : (params["q"] ? params["q"] : (params["f0"] && params["f0"] == "q" && params["fv0"]?params["fv0"]:""));
|
||||
this.selectedFields[0].value = this.keyword;
|
||||
this.selectedFields[0].value = StringUtils.URIDecode(this.keyword);
|
||||
this.quickFilter.selected = ((params['qf']== undefined || params["qf"] == "true") == true);
|
||||
if (params["type"] && params["type"].length > 0) {
|
||||
this.resultTypes['publication'] = (params["type"].split(",").indexOf("publications") != -1);
|
||||
|
|
|
@ -680,7 +680,7 @@ export class NewSearchPageComponent {
|
|||
} else {
|
||||
params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId,countParams,true);
|
||||
}*/
|
||||
params = NewSearchPageComponent.createKeywordQuery(this.entityType,this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams);
|
||||
params += NewSearchPageComponent.createKeywordQuery(this.entityType,this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams);
|
||||
//TODO deposit case
|
||||
// console.log(this.usedBy)
|
||||
// console.log(this.keywordFields)
|
||||
|
@ -797,7 +797,7 @@ export class NewSearchPageComponent {
|
|||
}
|
||||
private static getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
|
||||
if(isSearchAll){
|
||||
return value ;
|
||||
return StringUtils.URIEncode(value);
|
||||
}else{
|
||||
return fieldId+"="+ StringUtils.URIEncode(value);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import {Observable, Subject} from 'rxjs';
|
|||
import {Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
|
||||
import {EntitiesSearchService} from './entitySearch.service';
|
||||
import{EnvProperties} from '../properties/env-properties';
|
||||
import {StringUtils} from "../string-utils.class";
|
||||
|
||||
|
||||
//Usage example
|
||||
|
@ -129,7 +130,7 @@ export class EntitiesAutocompleteComponent {
|
|||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
switchMap((term: string) => {
|
||||
var results = this._search.searchByType(term, this.entityType, this.properties);
|
||||
var results = this._search.searchByType(StringUtils.URIEncode(term), this.entityType, this.properties);
|
||||
this.showLoading = false;
|
||||
this.results = results.length;
|
||||
return results;
|
||||
|
|
|
@ -36,7 +36,7 @@ export class ISVocabulariesService {
|
|||
} else if (field == "type" && (entity == "software" || entity == "other")) {
|
||||
return of([]);
|
||||
|
||||
} else if (field == "access" && (entity == "publication" || entity == "dataset" || entity == "software" || entity == "other")) {
|
||||
} else if (field == "access" && (entity == "publication" || entity == "dataset" || entity == "software" || entity == "other" || entity == "result")) {
|
||||
// file= "accessMode.json";
|
||||
// return this.getVocabularyFromFile(file);
|
||||
vocabulary = "dnet:access_modes.json";
|
||||
|
|
Loading…
Reference in New Issue