complete previous commit for

clean up search dataproviders for doiRawValue
This commit is contained in:
argirok 2022-02-21 16:29:03 +02:00
parent 49dfdd6e1b
commit 514cd0dd12
2 changed files with 15 additions and 24 deletions

View File

@ -43,7 +43,6 @@ import {properties} from "../../../environments/environment";
[sort]="false" [showBreadcrumb]="showBreadcrumb" [basicMetaDescription]="metaDescription">
</new-search-page>
<!-- [filters]="filters"-->
`
})
@ -140,13 +139,9 @@ export class SearchDataProvidersComponent {
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
this.searchPage.usedBy = "deposit";
}
// console.log(this.refineFields)
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
if(refine /*&& (this.type == "all" || this.type == "deposit")*/) {
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
// } else if(refine) { // static filters
// this.searchUtils.refineStatus = this.errorCodes.LOADING;
// this.filters = DatasourcesHelperClass.createFilters(this.type);
} else {
this.searchUtils.refineStatus = this.errorCodes.DONE;
}
@ -198,7 +193,6 @@ export class SearchDataProvidersComponent {
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(filters, totalResults);
}
console.log(filters)
this.searchUtils.refineStatus = this.errorCodes.DONE;
if(totalResults == 0) {
this.searchUtils.refineStatus = this.errorCodes.NONE;
@ -232,35 +226,22 @@ console.log(filters)
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
// if(parameters!= null && parameters != '' ) {
// this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
// }else{
// this.csvParams ="&fq="+this.resourcesQuery;
// }
// this.csvParams += (refineFieldsFilterQuery?refineFieldsFilterQuery:'');
this.csvParams = (parameters ? ("&fq=("+parameters) : "") + (parameters ? ")" : "");
this.csvParams += (refineFieldsFilterQuery ? refineFieldsFilterQuery : "");
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Content Providers: Execute search query "+parameters);
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
//this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
this.searchResultsSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
data => {
let totalResults = data[0];
let results = data[1];
/* if(refine && !(this.type == "all" || this.type == "deposit")){
this.filtersReturned(refine, this.filters, totalResults, page);
}*/
this.resultsReturned(refine, results, totalResults, page);
},
err => {

View File

@ -157,13 +157,22 @@ export class Identifier {
var words: string[] = str.split(" ");
for (var i = 0; i < words.length; i++) {
if (DOI.isValidDOI(words[i]) && DOIs.indexOf(words[i]) == -1) {
DOIs.push(words[i]);
let id = words[i];
if (DOI.isValidDOI(id) ) {
id = Identifier.getRawDOIValue(id);
if( DOIs.indexOf(id) == -1){
DOIs.push(id);
}
}
}
return DOIs;
}
public static getRawDOIValue(id: string): string {
if(id.indexOf("doi.org")!=-1 && id.split("doi.org/").length > 1){
id = id.split("doi.org/")[1];
}
return id;
}
public static getIdentifiersFromString(str: string): Identifier[] {
let identifiers: Identifier[] = [];
let words: string[] = str.split(" ");
@ -181,6 +190,7 @@ export class Identifier {
public static getIdentifierFromString(pid: string,strict:boolean = true): Identifier {
if (Identifier.isValidDOI(pid)) {
pid = Identifier.getRawDOIValue(pid);
return {"class": "doi", "id": pid};
} else if (Identifier.isValidORCID(pid)) {
return {"class": "ORCID", "id": pid};