Support not includes in advanced form for any field
This commit is contained in:
parent
9e7a6852cc
commit
0bd6b3cfb1
|
@ -27,8 +27,7 @@
|
|||
<div class="uk-grid uk-flex-middle uk-child-width-1-2@m uk-child-width-1-1">
|
||||
<div input [(value)]="selectedField.id" inputClass="border-bottom"
|
||||
[options]="fieldIdsOptions" (valueChange)="fieldIdsChanged(i,selectedField.id)" type="select"></div>
|
||||
<div input *ngIf="selectedField.id != 'q'" [(value)]="selectedField.includes" inputClass="border-bottom" [options]="getNotOperators(selectedField)" type="select"></div>
|
||||
<div *ngIf="selectedField.id == 'q'">includes</div>
|
||||
<div input [(value)]="selectedField.includes" inputClass="border-bottom" [options]="getNotOperators(selectedField)" type="select"></div>
|
||||
</div>
|
||||
<!-- <mat-select [(ngModel)]="selectedField.id" name="selectField_{{i}}" [disableOptionCentering]="true" class="matSelection" panelClass="matSelectionPanel"
|
||||
(ngModelChange)="fieldIdsChanged(i,selectedField.id)"><!–(click)="fieldIdsChanged(i)" –>
|
||||
|
|
|
@ -771,7 +771,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
if (params["f" + i] && params["fv" + i]) {
|
||||
let fieldId = params["f" + i].split(",")[0];
|
||||
let operator = (params["f" + i].split(",").length > 1) ? params["f" + i].split(",")[1] : "and";
|
||||
let not: boolean = params["fo" + i] === "not" && fieldId != 'q';
|
||||
let not: boolean = params["fo" + i] === "not";
|
||||
let fieldparam = (this.fieldIdsMap[fieldId]) ? this.fieldIdsMap[fieldId].param : "";
|
||||
|
||||
if (!this.fieldIdsMap[fieldId]) {
|
||||
|
@ -907,7 +907,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
} else {
|
||||
params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId,countParams,true);
|
||||
}*/
|
||||
params += NewSearchPageComponent.createKeywordQuery(this.entityType, this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams);
|
||||
params += NewSearchPageComponent.createKeywordQuery(this.entityType, this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams, this.selectedFields[i].includes);
|
||||
//TODO deposit case
|
||||
// console.log(this.usedBy)
|
||||
// console.log(this.keywordFields)
|
||||
|
@ -970,9 +970,12 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
return params;
|
||||
}
|
||||
|
||||
public static createKeywordQuery(entityType: string, value: string, id, operatorId, countParams = 0) {
|
||||
public static createKeywordQuery(entityType: string, value: string, id, operatorId, countParams = 0, includes: boolean = true) {
|
||||
let params = "";
|
||||
let doisParams = "";
|
||||
if(!includes) {
|
||||
params += "(*=* NOT ";
|
||||
}
|
||||
var DOIs: Identifier[] = Identifier.getIdentifiersFromString(value);
|
||||
if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service")) {
|
||||
for (let identifier of DOIs) {
|
||||
|
@ -995,6 +998,9 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true,
|
||||
(DOIs.length > 0 && doisParams.length == 0));
|
||||
}
|
||||
if(!includes) {
|
||||
params += ")";
|
||||
}
|
||||
return params;
|
||||
|
||||
}
|
||||
|
@ -1352,7 +1358,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
if ((this.selectedFields[i].value && this.selectedFields[i].value.length > 0) || this.selectedFields[i].type == "date") {
|
||||
this.parameterNames.push("f" + i);
|
||||
this.parameterValues.push(this.selectedFields[i].id + (this.selectedFields[i].operatorId != 'and' ? ("," + this.selectedFields[i].operatorId) : ''));
|
||||
if(!this.selectedFields[i].includes && this.selectedFields[i].id !== "q") {
|
||||
if(!this.selectedFields[i].includes) {
|
||||
this.parameterNames.push("fo" + i);
|
||||
this.parameterValues.push("not");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue