apply changes for datasource search pages #7546

This commit is contained in:
argirok 2022-02-16 18:43:20 +02:00
parent 304276f3bc
commit 497a19a60d
3 changed files with 36 additions and 17 deletions

View File

@ -38,7 +38,7 @@ import {properties} from "../../../environments/environment";
[entitiesSelection]="type=='all'" [showSwitchSearchLink]="showSwitchSearchLink"
[filters]="filters"
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
[showResultCount]="(type=='all' || type == 'deposit')" [showIndexInfo]="type!='deposit'"
[showResultCount]="true" [showIndexInfo]="type!='deposit'"
[tableViewLink]="tableViewLink"
[sort]="false" [showBreadcrumb]="showBreadcrumb" [basicMetaDescription]="metaDescription">
@ -142,11 +142,11 @@ export class SearchDataProvidersComponent {
}
// 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.type == "all" || this.type == "deposit")*/) {
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 if(refine) { // static filters
// this.searchUtils.refineStatus = this.errorCodes.LOADING;
// this.filters = DatasourcesHelperClass.createFilters(this.type);
} else {
this.searchUtils.refineStatus = this.errorCodes.DONE;
}
@ -173,7 +173,7 @@ export class SearchDataProvidersComponent {
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
this.searchFiltersSub = 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"))
this.searchFiltersSub = 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"))
//.switchMap(
.subscribe(
data => {
@ -198,7 +198,7 @@ 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;
@ -258,9 +258,9 @@ export class SearchDataProvidersComponent {
data => {
let totalResults = data[0];
let results = data[1];
if(refine && !(this.type == "all" || this.type == "deposit")){
/* if(refine && !(this.type == "all" || this.type == "deposit")){
this.filtersReturned(refine, this.filters, totalResults, page);
}
}*/
this.resultsReturned(refine, results, totalResults, page);
},
err => {

View File

@ -1,5 +1,6 @@
import {Filter, Value} from "./searchHelperClasses.class";
import {SearchFields} from "../../utils/properties/searchFields";
import {properties} from "../../../../environments/environment";
export class DatasourcesHelperClass {
@ -42,8 +43,11 @@ export class DatasourcesHelperClass {
}
}
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
if(properties.environment == "production") {
if (type == "registries") {
return ' datasourcetypeuiid = other ';
return ' (datasourcetypeuiid = "entityregistry" or datasourcetypeuiid = "entityregistry::products" or datasourcetypeuiid = "entityregistry::repositories" ' +
'or datasourcetypeuiid = "entityregistry::organizations" or datasourcetypeuiid = "entityregistry::researchers" ) ';
} else if (type == "journals") {
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
@ -55,6 +59,21 @@ export class DatasourcesHelperClass {
} else {
return "";
}
}else{
if (type == "registries") {
return 'datasourcetypeuiname exact "Registry"';
} else if (type == "journals") {
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and datasourcetypeuiname exact "Journal archive" ';
} else if (type == "compatible") {
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiname exact "Repository" ';
}else if (type == "deposit") {
return ' oaftype exact datasource and (datasourcetypeuiname exact "Journal archive" or datasourcetypeuiname exact "Repository")';
} else {
return "";
}
}
}
public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit"): Filter[] {
@ -62,8 +81,8 @@ export class DatasourcesHelperClass {
return this.createRegistriesFilters();
} else if (type == "journals") {
return this.createJournalFilters();
} else if (type == "compatible") {
return this.createCompatibleFilters();
/* } else if (type == "compatible") {
return this.createCompatibleFilters();*/
} else {
return [];
}

View File

@ -426,7 +426,7 @@ export class SearchFields {
param: "type",
operator: "tp",
equalityOperator: " exact ",
filterType: "checkbox"
filterType: "radio"
},
["datasourcetypename"]: {
name: "Type",
@ -434,7 +434,7 @@ export class SearchFields {
param: "type",
operator: "tp",
equalityOperator: " exact ",
filterType: null
filterType: "radio"
},
["datasourceodlanguages"]: {
name: "Language",
@ -511,7 +511,7 @@ export class SearchFields {
{"name": "country", "equalityOperator": " exact "},
{"name": "datasourcesubject", "equalityOperator": " all "}
];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypeuiname", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: {
@ -556,9 +556,9 @@ export class SearchFields {
},
};
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypeuiid", "datasourcecompatibilityname"];
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypeuiid", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
//ORGANIZATION