diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index 61965f18..bbfd64e4 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -125,7 +125,9 @@ export class SearchPageComponent { } var keyword = params['keyword']; console.info("Type:" + this.type + "filters: "+(this.type == 'publication'?allFqs:parameters)); - return (keyword && keyword.length > 0?'q='+keyword+"&op=and":'')+(this.type == 'publication'?allFqs:parameters); + var doiQuery =(keyword && keyword.length > 0 && keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ keyword+'"))':""; + var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(keyword) + ")" + doiQuery + ")":this.quote(keyword); + return (keyword && keyword.length > 0?'q='+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:keyword)+"&op=and":'')+(this.type == 'publication'?allFqs:parameters); } public getIndexQueryParametersFromUrl(params){ var parameters = ""; @@ -155,10 +157,12 @@ export class SearchPageComponent { } var keyword = params['keyword']; - parameters += (keyword && keyword.length > 0?' and '+keyword+' ':''); + var doiQuery =(keyword.length > 0 && keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ keyword+'"))':""; + var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(keyword) + ")" + doiQuery + ")":this.quote(keyword); + // parameters += (keyword && keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:keyword)+' ':''); // allFqs += ; - return (keyword && keyword.length > 0?' and '+keyword+' ':'')+allFqs; + return (keyword && keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:keyword)+' ':'')+allFqs; } /* * Mark as check the new filters that are selected, when you get them from search @@ -245,7 +249,9 @@ export class SearchPageComponent { } } //TODO when final search is done- remove op=and from keyword - return (this.searchUtils.keyword.length > 0?'q='+this.searchUtils.keyword+"&op=and":'')+(this.type == 'publication'?allFqs:allLimits); + var doiQuery =(this.searchUtils.keyword.length > 0 && this.searchUtils.keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ this.searchUtils.keyword+'"))':""; + var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(this.searchUtils.keyword) + ")" + doiQuery + ")":this.quote(this.searchUtils.keyword); + return (this.searchUtils.keyword.length > 0?'q='+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:this.searchUtils.keyword)+"&op=and":'')+(this.type == 'publication'?allFqs:allLimits); } private createIndexQueryParameters(filters:Filter[]){ //TODO @@ -275,7 +281,9 @@ export class SearchPageComponent { } } // allLimits += (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':''); - return (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':'')+allFqs; + var doiQuery =(this.searchUtils.keyword.length > 0 && this.searchUtils.keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ this.searchUtils.keyword+'"))':""; + var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(this.searchUtils.keyword) + ")" + doiQuery + ")":this.quote(this.searchUtils.keyword); + return (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:this.searchUtils.keyword)+' ':'')+allFqs; } // private isFiltered(){ diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts index 02dc0ece..e91876b8 100644 --- a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts @@ -14,7 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; selector: 'search-datasets', template: ` - diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts index 60601682..9486ff94 100644 --- a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts @@ -13,7 +13,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; selector: 'search-organizations', template: ` - diff --git a/portal-2/src/app/searchPages/simple/searchPeople.component.ts b/portal-2/src/app/searchPages/simple/searchPeople.component.ts index 5ba03877..3951fd0d 100644 --- a/portal-2/src/app/searchPages/simple/searchPeople.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPeople.component.ts @@ -15,7 +15,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; selector: 'search-people', template: ` - diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts index 059444a2..eff3e575 100644 --- a/portal-2/src/app/services/searchPublications.service.ts +++ b/portal-2/src/app/services/searchPublications.service.ts @@ -27,7 +27,7 @@ export class SearchPublicationsService { if(refineParams!= null && refineParams != '' ) { url += refineParams; } - url += "&page="+page+"&size="+size; + url += "&page="+(page-1)+"&size="+size; let key = url; if (this._cache.has(key)) { diff --git a/portal-2/src/app/utils/properties/searchFields.ts b/portal-2/src/app/utils/properties/searchFields.ts index a031a016..a06538d4 100644 --- a/portal-2/src/app/utils/properties/searchFields.ts +++ b/portal-2/src/app/utils/properties/searchFields.ts @@ -5,11 +5,12 @@ export class SearchFields { "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", "resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"]; public ADVANCED_SEARCH_PUBLICATIONS_PARAM:string[] = ["q","title","author","publisher","type", "lang","project", "funder", "funderlv0", - "funderlv1","funderlv2","community","access","hostedBy","collectedFrom"]; + "funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom"]; public PUBLICATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community", [ "relprojectid"]:"project",[ "relfunderid"]:"funder", ["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2", - ["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom"}; + ["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom", + ["pid"]:"pid"}; public PUBLICATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={ ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="}, ["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", equalityOperator: "="}, @@ -25,7 +26,9 @@ export class SearchFields { ["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid", equalityOperator: " exact "}, ["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', equalityOperator: " exact "}, ["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid", equalityOperator: " exact "}, - ["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid", equalityOperator: " exact "} + ["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid", equalityOperator: " exact "}, + ["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "} + }; //PROJECT @@ -82,11 +85,12 @@ export class SearchFields { "relfunderid", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", "resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"]; public ADVANCED_SEARCH_DATASET_PARAM:string[] = ["q","title","author","publisher","type", "lang", "funder", "funderlv0", - "funderlv1","funderlv2","community","access","hostedBy","collectedFrom"]; + "funderlv1","funderlv2","community","access","pid","hostedBy","collectedFrom"]; public DATASET_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community", [ "relprojectid"]:"project", [ "relfunderid"]:"funder", ["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2", - ["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom"}; + ["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom", + ["pid"]:"pid"}; public DATASET_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={ ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="}, ["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", equalityOperator: "="}, @@ -102,7 +106,8 @@ export class SearchFields { ["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid", equalityOperator: " exact "}, ["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', equalityOperator: " exact "}, ["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid", equalityOperator: " exact "}, - ["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid", equalityOperator: " exact "} + ["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid", equalityOperator: " exact "}, + ["pid"]: {name:"PID",operator:"pd", type:"keyword", indexField:"pid", equalityOperator: " exact "} };