diff --git a/searchPages/dataProviders/compatibleDataProviders.component.ts b/searchPages/dataProviders/compatibleDataProviders.component.ts index ecf21353..9dc150e8 100644 --- a/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -76,7 +76,7 @@ properties:EnvProperties; .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.baseUrl = data.envSpecific.searchLinkToCompatibleDataProviders - this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html"; + // this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html"; }); this.searchPage.refineFields = this.refineFields; diff --git a/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/searchPages/dataProviders/compatibleDataProvidersTable.component.ts index 7cb6d95a..a31c8ce9 100644 --- a/searchPages/dataProviders/compatibleDataProvidersTable.component.ts +++ b/searchPages/dataProviders/compatibleDataProvidersTable.component.ts @@ -67,7 +67,7 @@ properties:EnvProperties; .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProvidersTable; - this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html"; + // this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html"; }); this.refineFields.push("datasourcecountryname"); this.searchPage.refineFields = this.refineFields; diff --git a/searchPages/dataProviders/entityRegistries.component.ts b/searchPages/dataProviders/entityRegistries.component.ts index c3310aec..c4123c0d 100644 --- a/searchPages/dataProviders/entityRegistries.component.ts +++ b/searchPages/dataProviders/entityRegistries.component.ts @@ -77,7 +77,7 @@ properties:EnvProperties; .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders; - this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries"; + // this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries"; }); this.searchPage.refineFields = this.refineFields; diff --git a/searchPages/dataProviders/entityRegistriesTable.component.ts b/searchPages/dataProviders/entityRegistriesTable.component.ts index 7aca2056..b7ab3e0f 100644 --- a/searchPages/dataProviders/entityRegistriesTable.component.ts +++ b/searchPages/dataProviders/entityRegistriesTable.component.ts @@ -59,7 +59,7 @@ properties:EnvProperties; .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders; - this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries"; + // this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries"; }); this.refineFields.push("datasourcecountryname"); this.searchPage.refineFields = this.refineFields; diff --git a/searchPages/dataProviders/journals.component.ts b/searchPages/dataProviders/journals.component.ts index 11e77135..7aea153b 100644 --- a/searchPages/dataProviders/journals.component.ts +++ b/searchPages/dataProviders/journals.component.ts @@ -78,7 +78,7 @@ properties:EnvProperties; .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.baseUrl = data.envSpecific.searchLinkToJournals; - this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals"; + // this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals"; }); this.searchPage.refineFields = this.refineFields; diff --git a/searchPages/dataProviders/journalsTable.component.ts b/searchPages/dataProviders/journalsTable.component.ts index abf4ecaf..150991b9 100644 --- a/searchPages/dataProviders/journalsTable.component.ts +++ b/searchPages/dataProviders/journalsTable.component.ts @@ -68,7 +68,7 @@ properties:EnvProperties; .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.baseUrl = data.envSpecific.searchLinkToJournalsTable; - this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals"; + // this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals"; }); this.searchPage.refineFields = this.refineFields; this.sub = this.route.queryParams.subscribe(params => { diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 6886598c..c6ad37c6 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -9,6 +9,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl import {EnvProperties} from '../utils/properties/env-properties'; import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; +import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class"; @Component({ @@ -16,7 +17,7 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; template: ` + [simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..." + [showResultCount]="type!='registries'"> ` @@ -62,8 +63,9 @@ export class SearchDataProvidersComponent { public pagingLimit: number = 0; public isPiwikEnabled; properties:EnvProperties; - - public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS; + @Input() type: "all" | "registries" | "journals" | "compatible" ="all"; + public refineFields: string[] = DatasourcesHelperClass.getrefineFields(this.type); + pageTitle = DatasourcesHelperClass.getTitle(this.type); @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; @Input() simpleSearchLink: string = ""; @@ -86,7 +88,7 @@ export class SearchDataProvidersComponent { .subscribe((data: { envSpecific: EnvProperties }) => { this.properties= data.envSpecific; if (!this.simpleSearchLink) { - this.simpleSearchLink = this.properties.searchLinkToProjects; + this.simpleSearchLink = this.properties.searchLinkToDataProviders; } this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; this.pagingLimit = data.envSpecific.pagingLimit; @@ -94,8 +96,9 @@ export class SearchDataProvidersComponent { }); - var firstLoad = true; - this.sub = this.route.queryParams.subscribe(params => { + let firstLoad = true; + this.filters = DatasourcesHelperClass.createFilters(this.type); + this.sub = this.route.queryParams.subscribe(params => { this.loadPaging = true; if(params['page'] && this.searchUtils.page != params['page']) { this.loadPaging = false; @@ -117,11 +120,6 @@ export class SearchDataProvidersComponent { this.searchPage.fieldIds = this.fieldIds; this.selectedFields =[]; this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider"); - - // this.searchPage.selectedFields = this.selectedFields; - // this.searchPage.fieldIdsMap = this.fieldIdsMap; - // this.searchPage.customFilter = this.customFilter; - // this.searchPage.getSelectedFiltersFromUrl(params); this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); }); } @@ -154,12 +152,13 @@ export class SearchDataProvidersComponent { this.searchUtils.totalResults = 0; //console.info("Advanced Search for Content Providers: Execute search query "+parameters); - this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( + let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type); + this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and ':'') + parameters, page, size, this.properties, (refine && this.type=="all") ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( data => { this.searchUtils.totalResults = data[0]; this.results = data[1]; if (refine) { - this.filters = this.searchPage.prepareFiltersToShow(data[2]); + this.filters = this.searchPage.prepareFiltersToShow(this.type=="all"?data[2]:this.filters); }else{ this.searchPage.buildPageURLParameters(this.filters, [], false); } diff --git a/searchPages/searchUtils/advancedSearchForm.component.html b/searchPages/searchUtils/advancedSearchForm.component.html index f06e4f88..9788091c 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.html +++ b/searchPages/searchUtils/advancedSearchForm.component.html @@ -11,7 +11,8 @@
+ [class]="((isDisabled )?'uk-disabled ':'') + +' advancedSearchForm uk-tile uk-padding-small uk-margin-medium-bottom'">
@@ -19,29 +20,37 @@ [quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null" [properties]="properties" > - +
+
+ + + + - - - - + + + + +
Field to searchTerm
Search for: +
+ + +
+ + +
- + - - - No
+
+ Add rule +
+
- - + - + - - + -
@@ -103,19 +121,18 @@
Please check your dates
- -
+
-
- +
@@ -124,7 +141,7 @@ -
@@ -140,7 +157,7 @@ class=" uk-button portal-button uk-margin-small-left uk-text-bold uk-padding uk-padding-remove-top uk-padding-remove-bottom"> Search -
+
Advanced search diff --git a/searchPages/searchUtils/advancedSearchForm.component.ts b/searchPages/searchUtils/advancedSearchForm.component.ts index 1776a399..80954f7f 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/searchPages/searchUtils/advancedSearchForm.component.ts @@ -38,6 +38,8 @@ export class AdvancedSearchFormComponent { selectedEntity; selectedEntitySimpleUrl; selectedEntityAdvancedUrl; + @Input() entitiesSelection:boolean; + @Input() showAdvancedSearchLink:boolean = true; constructor (private route: ActivatedRoute, private router: Router) { } @@ -112,6 +114,10 @@ export class AdvancedSearchFormComponent { }else{ this.selectedFields.splice(index, 1); } + //if only one filter left, set the operator to and + if(this.selectedFields.length==1){ + this.selectedFields[0].operatorId = "and"; + } } fieldOperatorChanged(index: number, operatorId: string, operatorName: string) { diff --git a/searchPages/searchUtils/datasourcesHelper.class.ts b/searchPages/searchUtils/datasourcesHelper.class.ts new file mode 100644 index 00000000..1dbe0d40 --- /dev/null +++ b/searchPages/searchUtils/datasourcesHelper.class.ts @@ -0,0 +1,178 @@ +import {Filter, Value} from "./searchHelperClasses.class"; +import {SearchFields} from "../../utils/properties/searchFields"; + +export class DatasourcesHelperClass { + + public static getrefineFields(type: "all" | "registries" | "journals" | "compatible") { + let searchFields:SearchFields = new SearchFields(); + if (type == "registries") { + return searchFields.ENTITY_REGISTRIES_FIELDS; + } else if (type == "journals") { + return searchFields.JOURNAL_FIELDS; + + } else if (type == "compatible") { + return searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; + } else { + return searchFields.DATASOURCE_REFINE_FIELDS; + } + } + + public static getTitle(type: "all" | "registries" | "journals" | "compatible") { + if (type == "registries") { + return "Entity Registries" + } else if (type == "journals") { + return "Journals" + + } else if (type == "compatible") { + return "Compatible Content Providers"; + } else { + return "Content Providers" + } + } + public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible"): string { + if (type == "registries") { + return ' datasourcetypeuiid = other '; + } 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" ) '; + + } else if (type == "compatible") { + return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" '; + } else { + return ""; + } + } + + public static createFilters(type: "all" | "registries" | "journals" | "compatible"): Filter[] { + if (type == "registries") { + return this.createRegistriesFilters(); + } else if (type == "journals") { + return this.createJournalFilters(); + } else if (type == "compatible") { + return this.createCompatibleFilters(); + } else { + return []; + } + } + + private static createCompatibleFilters(): Filter[] { + var filter_names = ["Type", "Compatibility Level"]; + var filter_ids = ["datasourcetypeuiid", "datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; + var value_names = [ + + [ + "Institutional Repository", "Thematic Repository", "Publication Repository", + "Institutional Repository Aggregator", + "Thematic Repository Aggregator", "Publication Repository Aggregator", + "Data Repository", "Data Repository Aggregator", "CRIS System", "Publication Catalogue", + "Software Repository", "Software Repository Aggregator"], + ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1", + "collected from a compatible aggregator", "proprietary", "under validation"]]; + + var value_original_ids = [ + ["pubsrepository::institutional", "pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional", "aggregator::pubsrepository::thematic", "aggregator::pubsrepository::unknown", + "datarepository::unknown", "aggregator::datarepository", "crissystem", "pubscatalogue::unknown", "softwarerepository", "aggregator::softwarerepository"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1", + "collected from a compatible aggregator", "proprietary", "under validation"]]; + var filters: Filter[] = []; + for (var i = 0; i < filter_names.length; i++) { + var values: Value[] = []; + for (var j = 0; j < value_names[i].length; j++) { + var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false} + values.push(value); + } + var filter: Filter = { + title: filter_names[i], + filterId: filter_ids[i], + originalFilterId: filter_original_ids[i], + values: values, + countSelectedValues: 0, + "filterOperator": 'or', + valueIsExact: true, + filterType: "checkbox" + }; + filters.push(filter); + } + return filters; + } + + private static createRegistriesFilters(): Filter[] { + var filter_names = ["Type", "Compatibility Level"]; + var filter_ids = ["datasourcetypename", "datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS; + var value_names = [ + ["Funder", "Registry of repositories", "Scholarly Comm. Infrastructure", "Registry", "Information Space", "Web Source"], + + ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)", + "collected from a compatible aggregator", "proprietary", "under validation"]]; + + var value_original_ids = [ + ["Funder database", "Registry of repositories", "Scholarly Comm. Infrastructure", "Registry", "Information Space", "Web Source"], + //["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)", + "collected from a compatible aggregator", "proprietary", "under validation"]]; + + var filters: Filter[] = []; + for (var i = 0; i < filter_names.length; i++) { + var values: Value[] = []; + for (var j = 0; j < value_names[i].length; j++) { + var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false} + values.push(value); + } + var filter: Filter = { + title: filter_names[i], + filterId: filter_ids[i], + originalFilterId: filter_original_ids[i], + values: values, + countSelectedValues: 0, + "filterOperator": 'or', + valueIsExact: true, + filterType: "checkbox" + }; + filters.push(filter); + } + return filters; + } + + + private static createJournalFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.JOURNAL_FIELDS; + var value_names=[ + /*[ + "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", + "Institutional Repositories Aggregators", + "Thematic Repositories Aggregators", "Other Repositories Aggregators", + "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"], + */ + ["Journal", "Journal Aggregator\/Publisher"], + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)", + "collected from a compatible aggregator", "proprietary", "under validation"]]; + + var value_original_ids=[ + ["pubsrepository::journal", "aggregator::pubsrepository::journals"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)", + "collected from a compatible aggregator", "proprietary", "under validation"]]; + var filters: Filter[] =[]; + for(var i =0 ; i < filter_names.length;i++){ + var values:Value[] = []; + for(var j =0 ; j < value_names[i].length;j++){ + var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:0, selected:false} + values.push(value); + } + var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, filterType: "checkbox" }; + filters.push(filter); + } + return filters; + } + + +} diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 34519fc9..4760383e 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -18,7 +18,8 @@ [advancedSearchLinkParameters] ="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)" [pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText" - [resultTypes]="resultTypes" [quickFilter]="quickFilter" + [resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection" + [showAdvancedSearchLink]="showAdvancedSearchLink" >
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index c1b85d02..7de228f8 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -86,6 +86,7 @@ export class NewSearchPageComponent { url = null; @Input() entitiesSelection:boolean = true; + @Input() showAdvancedSearchLink:boolean = true; constructor(private route: ActivatedRoute, private location: Location, private _meta: Meta, @@ -617,13 +618,16 @@ export class NewSearchPageComponent { } else { //Remove quotes from keyword search // params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " "; - params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + StringUtils.URIEncode(this.selectedFields[i].value) + " "; + // params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + StringUtils.URIEncode(this.selectedFields[i].value) + " "; + params += this.createQuotedKeywordQuery(this.selectedFields[i],countParams,true); } // params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " "; - } else if (countParams == 0 && this.selectedFields[i].operatorId == "not") { + } else if (countParams == 0 && this.selectedFields[i].operatorId == "not" && this.fieldIdsMap[this.selectedFields[i].id].equalityOperator != "=") { params += " " + this.selectedFields[i].id + " <> " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " "; - } else { - params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " "; + } else if(this.fieldIdsMap[this.selectedFields[i].id].equalityOperator == "=") { + params+=this.createQuotedKeywordQuery(this.selectedFields[i], countParams, false); + }else{ + params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " "; } } @@ -634,9 +638,66 @@ export class NewSearchPageComponent { if (this.customFilter) { params += (countParams == 0 ? "" : " and ") + this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)); } + console.log("ParameterS:") + console.log(params) return params; } + createQuotedKeywordQuery(field:AdvancedField, countParams:number, isSearchAll:boolean){ + console.log(field) + let params = ""; + let quotedParts = (field.value)?field.value.match(/(["'])(.*?)*?\1/g):[]; + console.log(quotedParts) + params+= (countParams == 0 ? "" : field.operatorId) + " ("; + if(quotedParts && quotedParts.length == 1 && quotedParts[0] == field.value ){ + params+=this.getQuotedQueryPart(field.id, field.value,isSearchAll); + }else if( quotedParts && quotedParts.length > 0){ + for(let i=0; i< quotedParts.length; i++){ + params+=(i>0)?" and ":""; + params+=this.getQuotedQueryPart(field.id, quotedParts[i],isSearchAll); + } + let startPoint = 0; + let endPoint = 0; + for(let i=0; i< quotedParts.length; i++){ + let index = field.value.indexOf(quotedParts[i]); + endPoint = (i+1 0) { + params += " and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint, endPoint), isSearchAll); + } + // console.log("For "+i+" " +params+" SP "+ startPoint+" EP: "+endPoint); + // startPoint = (i+1 0){ + params+=" and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint,field.value.length),isSearchAll); + } + }else{ + params+=this.getNoQuotedQueryPart(field.id, field.value,isSearchAll); + } + params += " )"; + return params; + } + + private getQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){ + return " ("+(isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value)+")"; + } + private getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){ + if(isSearchAll){ + return " (" + value + ")" + }else{ + return " ("+fieldId+"="+ StringUtils.URIEncode(value)+")"; + } + } + /** * Create Search API query based on the filters of refine fields * @param URLparams @@ -848,14 +909,7 @@ export class NewSearchPageComponent { * @param rangeFilters defined by the URL parameters * @param includePage */ -//<<<<<<< .mine buildPageURLParameters(filters:Filter[], rangeFilters: RangeFilter[], includePage: boolean) { - //console.log("buildPageURLParameters"); -// ||||||| .r58066 -// buildPageURLParameters(filters:Filter[],includePage: boolean) { -// ======= -// buildPageURLParameters(filters: Filter[], includePage: boolean) { -// >>>>>>> .r58095 this.parameterNames.splice(0, this.parameterNames.length); this.parameterValues.splice(0, this.parameterValues.length); var fields: { [key: string]: { values: string[], operators: string[] } } = {}; @@ -1160,7 +1214,6 @@ export class NewSearchPageComponent { * @param customFilter * @param params */ -//<<<<<<< .mine prepareSearchPage(fieldIds, selectedFields, refineFields, rangeFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null){ //console.log("prepareSearchPage"); this.entityType = entityType; @@ -1174,26 +1227,5 @@ export class NewSearchPageComponent { this.getRangeFiltersFromURL(params); this.getRefineFiltersFromURL(params); this.createAdvancedSearchSelectedFiltersFromURLParameters(params); -// ||||||| .r58066 -// prepareSearchPage(fieldIds, selectedFields, refineFields,fieldIdsMap, customFilter, params){ -// this.fieldIds = fieldIds; -// this.selectedFields = selectedFields; -// this.refineFields = refineFields; -// this.fieldIdsMap = fieldIdsMap; -// this.customFilter = customFilter; -// this.getRefineFiltersFromURL(params); -// this.createAdvancedSearchSelectedFiltersFromURLParameters(params); -// ======= -// prepareSearchPage(fieldIds, selectedFields, refineFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null) { -// this.entityType = entityType; -// this.fieldIds = fieldIds; -// this.selectedFields = selectedFields; -// this.refineFields = refineFields; -// this.fieldIdsMap = fieldIdsMap; -// this.customFilter = customFilter; -// this.quickFilter = quickFilter; -// this.getRefineFiltersFromURL(params); -// this.createAdvancedSearchSelectedFiltersFromURLParameters(params); } -//>>>>>>> .r58095 } diff --git a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts index a8c40c79..2870ff27 100644 --- a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts +++ b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts @@ -152,7 +152,8 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { private getDescription(result: any): String[] { const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null); if (!item) return null; - return [(item.substring(0,4997)+(item.substring(0,4997).length == 4997?'...':'')) as String]; + let descr = Array.isArray(item) ? item[0]:item; + return [(descr.substring(0,4997)+(descr.substring(0,4997).length == 4997?'...':'')) as String]; } private getDateCreated(result: any): String[] { diff --git a/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts b/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts index 1d3dc21b..a58e31c6 100644 --- a/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts +++ b/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts @@ -26,7 +26,7 @@ import{EnvProperties} from '../properties/env-properties';
- +
diff --git a/utils/rangeFilter/rangeFilter.component.html b/utils/rangeFilter/rangeFilter.component.html index 17ed0422..0e3f1607 100644 --- a/utils/rangeFilter/rangeFilter.component.html +++ b/utils/rangeFilter/rangeFilter.component.html @@ -17,7 +17,8 @@ [(ngModel)]="filter.selectedToValue" name="yearTo" #yearTo="ngModel" inValidYear placeholder="e.g. 2020"/>
- \ No newline at end of file + diff --git a/utils/staticAutoComplete/staticAutoComplete.component.ts b/utils/staticAutoComplete/staticAutoComplete.component.ts index 27bbfb54..f6f10a91 100644 --- a/utils/staticAutoComplete/staticAutoComplete.component.ts +++ b/utils/staticAutoComplete/staticAutoComplete.component.ts @@ -22,7 +22,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; - +