In pubs/data search page: Search also for DOI when keyword is only one word| In pubs/data Advanced search page: new field PID

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44739 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-11-30 11:54:45 +00:00
parent 478b2c8714
commit 136995ed44
6 changed files with 28 additions and 15 deletions

View File

@ -125,7 +125,9 @@ export class SearchPageComponent {
} }
var keyword = params['keyword']; var keyword = params['keyword'];
console.info("Type:" + this.type + "filters: "+(this.type == 'publication'?allFqs:parameters)); 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){ public getIndexQueryParametersFromUrl(params){
var parameters = ""; var parameters = "";
@ -155,10 +157,12 @@ export class SearchPageComponent {
} }
var keyword = params['keyword']; 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 += ; // 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 * 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 //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[]){ private createIndexQueryParameters(filters:Filter[]){
//TODO //TODO
@ -275,7 +281,9 @@ export class SearchPageComponent {
} }
} }
// allLimits += (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':''); // 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(){ private isFiltered(){

View File

@ -14,7 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'search-datasets', selector: 'search-datasets',
template: ` template: `
<search-page pageTitle="Search Datasets" type="datasource" [(filters)] = "filters" <search-page pageTitle="Search Datasets" type="dataset" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils" [(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" > [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page> </search-page>

View File

@ -13,7 +13,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'search-organizations', selector: 'search-organizations',
template: ` template: `
<search-page pageTitle="Search Organizations" type="datasource" [(filters)] = "filters" <search-page pageTitle="Search Organizations" type="organization" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils" [(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" > [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page> </search-page>

View File

@ -15,7 +15,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'search-people', selector: 'search-people',
template: ` template: `
<search-page pageTitle="Search People" type="people" [(filters)] = "filters" <search-page pageTitle="Search People" type="person" [(filters)] = "filters"
[(results)] = "results" [(results)] = "results"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false > [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
</search-page> </search-page>

View File

@ -27,7 +27,7 @@ export class SearchPublicationsService {
if(refineParams!= null && refineParams != '' ) { if(refineParams!= null && refineParams != '' ) {
url += refineParams; url += refineParams;
} }
url += "&page="+page+"&size="+size; url += "&page="+(page-1)+"&size="+size;
let key = url; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {

View File

@ -5,11 +5,12 @@ export class SearchFields {
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"]; "resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"];
public ADVANCED_SEARCH_PUBLICATIONS_PARAM:string[] = ["q","title","author","publisher","type", "lang","project", "funder", "funderlv0", 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", public PUBLICATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community",
[ "relprojectid"]:"project",[ "relfunderid"]:"funder", [ "relprojectid"]:"project",[ "relfunderid"]:"funder",
["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2", ["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 }} ={ 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: "="}, ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", 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 "}, ["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid", equalityOperator: " exact "},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', 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 "}, ["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 //PROJECT
@ -82,11 +85,12 @@ export class SearchFields {
"relfunderid", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", "relfunderid", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"]; "resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"];
public ADVANCED_SEARCH_DATASET_PARAM:string[] = ["q","title","author","publisher","type", "lang", "funder", "funderlv0", 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", public DATASET_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community",
[ "relprojectid"]:"project", [ "relfunderid"]:"funder", [ "relprojectid"]:"project", [ "relfunderid"]:"funder",
["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2", ["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 }} ={ 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: "="}, ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", 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 "}, ["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid", equalityOperator: " exact "},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', 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 "}, ["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 "}
}; };