[Library|Trunk]

Use searchDataproviders Component for Deposit, Registries, Journals and Compatible pages
Update searchDataproviders Component to support the above search pages

Entities autocomplete: show "no title available" when the entity with the selected id is not found  




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58244 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-03-12 17:03:35 +00:00
parent 91a6a82977
commit b28f08e4b8
9 changed files with 194 additions and 126 deletions

View File

@ -5,15 +5,14 @@ import {SearchDataprovidersService} from '../services/searchDataproviders.servic
import {ErrorCodes} from '../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../utils/errorMessages.component';
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from '../searchPages/searchUtils/searchPage.component';
import {SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class';
import {EnvProperties} from '../utils/properties/env-properties';
import {StringUtils} from "../utils/string-utils.class";
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
import {RouterHelper} from "../utils/routerHelper.class";
@Component({
selector: 'search-dataproviders',
selector: 'deposit-search-dataproviders',
template: `
<div class="uk-section uk-padding-remove-bottom uk-padding-remove-top">
@ -29,22 +28,8 @@ import {RouterHelper} from "../utils/routerHelper.class";
</div>
</div>
</div>
<search-page pageTitle="Deposit Browse & Search repositories" [hasPrefix]=false
formPlaceholderText = "Search by title, country, organization, subject, type..."
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
[searchFormClass]="''"
[usedBy]="'deposit'"
[showMoreFilterValuesInline]=true
[filterValuesNum]=4
[lastIndex]=false
[zenodoInformation]="zenodoInformation">
</search-page>
<search-dataproviders [simpleView]="true" type="deposit" simpleSearchLink="/participate/deposit/search" >
</search-dataproviders>
`
})
export class SearchDataprovidersToDepositComponent {
@ -71,7 +56,7 @@ export class SearchDataprovidersToDepositComponent {
properties:EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
// @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
@Input() public communityId: string = null;
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@ -94,34 +79,34 @@ export class SearchDataprovidersToDepositComponent {
this.baseUrl = this.properties.depositSearchPage;
this.pagingLimit = this.properties.pagingLimit;
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.keywordFields = this.keywordFields;
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.size = (params['size']=== undefined)?5:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 5;
}
this.searchPage.usedBy = "deposit";
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
// this.searchPage.refineFields = this.refineFields;
// this.searchPage.fieldIdsMap = this.fieldIdsMap;
// this.searchPage.keywordFields = this.keywordFields;
// var firstLoad =true;
//
// this.sub = this.route.queryParams.subscribe(params => {
// this.loadPaging = true;
// if(params['page'] && this.searchUtils.page != params['page']) {
// this.loadPaging = false;
// this.oldTotalResults = this.searchUtils.totalResults;
// }
//
// this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
// var refine = true;
// if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
// refine = false;
//
// }
// firstLoad = false;
// this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
// this.searchUtils.size = (params['size']=== undefined)?5:+params['size'];
// if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
// this.searchUtils.size = 5;
// }
// this.searchPage.usedBy = "deposit";
// var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
// this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
// });
}
public ngOnDestroy() {
@ -133,7 +118,7 @@ export class SearchDataprovidersToDepositComponent {
}
}
public getResults(keyword:string,refine:boolean, page: number, size: number){
/*public getResults(keyword:string,refine:boolean, page: number, size: number){
var parameters = "";
if(keyword.length > 0){
//parameters = "q="+ keyword;
@ -201,7 +186,7 @@ export class SearchDataprovidersToDepositComponent {
);
}
}
*/
private handleError(message: string, error) {
console.error("Content Providers simple Search Page: "+message, error);

View File

@ -9,16 +9,17 @@ import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.mod
import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
import {SearchFormModule} from '../searchPages/searchUtils/searchForm.module';
import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module';
// import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module';
import {FreeGuard} from'../login/freeGuard.guard';
import {IsRouteEnabled} from '../error/isRouteEnabled.guard';
import {SearchDataProvidersModule} from "../searchPages/searchDataProviders.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
SearchFormModule, SearchResultsModule, SearchDataProvidersModule
],
declarations: [

View File

@ -31,11 +31,13 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
[openaireLink]=openaireLink
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
searchFormClass="datasourcesSearchForm"
[searchFormClass]="type!='deposit'?'datasourcesSearchForm':''"
[entitiesSelection]="type=='all'" [showAdvancedSearchLink]="type=='all'"
[filters]="filters"
[simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..."
[showResultCount]="type!='registries'">
[showResultCount]="(type=='all' || type == 'deposit')" [showLastIndex]="type!='deposit'"
[tableViewLink]="tableViewLink">
</new-search-page>
`
@ -46,6 +48,7 @@ export class SearchDataProvidersComponent {
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() customFilter:SearchCustomFilter= null;
@Input() tableViewLink;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -63,9 +66,9 @@ export class SearchDataProvidersComponent {
public pagingLimit: number = 0;
public isPiwikEnabled;
properties:EnvProperties;
@Input() type: "all" | "registries" | "journals" | "compatible" ="all";
public refineFields: string[] = DatasourcesHelperClass.getrefineFields(this.type);
pageTitle = DatasourcesHelperClass.getTitle(this.type);
@Input() type: "all" | "registries" | "journals" | "compatible" | "deposit" = "all";
public refineFields: string[];
pageTitle;
@ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
@Input() simpleView: boolean = true;
@Input() simpleSearchLink: string = "";
@ -79,11 +82,10 @@ export class SearchDataProvidersComponent {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
//console.info("Con -base url:"+this.searchUtils.baseUrl );
}
ngOnInit() {
this.refineFields = DatasourcesHelperClass.getrefineFields(this.type);
this.pageTitle = DatasourcesHelperClass.getTitle(this.type);
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
@ -119,6 +121,11 @@ export class SearchDataProvidersComponent {
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
if(this.type == "deposit"){
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
this.searchPage.usedBy = "deposit";
}
console.log(this.refineFields)
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
});
@ -153,12 +160,13 @@ export class SearchDataProvidersComponent {
//console.info("Advanced Search for Content Providers: Execute search query "+parameters);
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(
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")).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
console.log(this.results);
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(this.type=="all"?data[2]:this.filters);
this.filters = this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters);
}else{
this.searchPage.buildPageURLParameters(this.filters, [], false);
}

View File

@ -3,7 +3,8 @@ import {SearchFields} from "../../utils/properties/searchFields";
export class DatasourcesHelperClass {
public static getrefineFields(type: "all" | "registries" | "journals" | "compatible") {
public static getrefineFields(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
console.log("Get RF "+ type)
let searchFields:SearchFields = new SearchFields();
if (type == "registries") {
return searchFields.ENTITY_REGISTRIES_FIELDS;
@ -12,24 +13,25 @@ export class DatasourcesHelperClass {
} else if (type == "compatible") {
return searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
} else if (type == "deposit") {
return searchFields.DEPOSIT_DATASOURCE_REFINE_FIELDS;
} else {
return searchFields.DATASOURCE_REFINE_FIELDS;
}
}
public static getTitle(type: "all" | "registries" | "journals" | "compatible") {
public static getTitle(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
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 {
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
if (type == "registries") {
return ' datasourcetypeuiid = other ';
} else if (type == "journals") {
@ -38,12 +40,14 @@ export class DatasourcesHelperClass {
} else if (type == "compatible") {
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" ';
}else if (type == "deposit") {
return ' oaftype exact datasource ';
} else {
return "";
}
}
public static createFilters(type: "all" | "registries" | "journals" | "compatible"): Filter[] {
public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit"): Filter[] {
if (type == "registries") {
return this.createRegistriesFilters();
} else if (type == "journals") {

View File

@ -1,8 +1,16 @@
<div *ngIf="!includeOnlyResultsAndFilter" class="image-front-topbar uk-section-default uk-position-relative"
<div *ngIf="!includeOnlyResultsAndFilter" [class]="usedBy != 'deposit' && (!customFilter || customFilter.queryFieldName != 'communityId') ?
' image-front-topbar uk-section-default uk-position-relative ' :
(' uk-section uk-padding-remove-bottom uk-padding-remove-top ' + (usedBy
== 'deposit' ? ' uk-padding-remove-top ' : ' '))"
uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
<div style="box-sizing: border-box; " [class]="' uk-background-norepeat uk-background-cover uk-background-bottom-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed advancedSearchFormBackground '+searchFormClass">
<div class="uk-position-cover" style="/*background-color: rgba(255, 255, 255, 0.37);*/"></div>
<div style="box-sizing: border-box; "
[class]="' uk-background-norepeat uk-background-bottom-center uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed '+searchFormClass
+ (usedBy != 'deposit' && (!customFilter || customFilter.queryFieldName != 'communityId') ?
' searchFormMinHeight uk-padding-remove-bottom uk-section ' : '')
+(simpleView?'':' advancedSearchFormBackground ')">
<div class="uk-position-cover" ></div>
<div class="uk-width-1-1">
<div class="uk-position-relative">
<div class="uk-container uk-margin-large-top">
@ -71,14 +79,14 @@
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-width-1-1 uk-margin-small-bottom uk-margin-top">
<span *ngIf="tableViewLink " class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
</span>
<!-- <span *ngIf="tableViewLink " class="uk-width-expand">-->
<!-- <span *ngIf="tableViewLink">-->
<!-- <a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >-->
<!-- <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>-->
<!-- </a>-->
<!-- <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>-->
<!-- </span>-->
<!-- </span>-->
<!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=-->
<!-- 'community' && entityType != 'funder') && usedBy == 'search'"-->
<!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
@ -173,14 +181,14 @@
<div *ngIf="showRefine" class="uk-width-1-4@m search-filters uk-visible@m">
<!-- top: #container-1; bottom: #true; -->
<!-- <div id="container-1" style="z-index: -1;" uk-sticky="top: #container-1; offset: 120; "> -->
<span *ngIf="tableViewLink" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
</span>
<!-- <span *ngIf="tableViewLink" class="uk-width-expand">-->
<!-- <span *ngIf="tableViewLink">-->
<!-- <a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >-->
<!-- <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>-->
<!-- </a>-->
<!-- <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>-->
<!-- </span>-->
<!-- </span>-->
<!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=-->
<!-- 'community' && entityType != 'funder') && usedBy == 'search'"-->
<!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
@ -272,6 +280,16 @@
[loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils"
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
</search-download>
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active"
[class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-link-text uk-margin-small-left'"
[routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
Table view
</a>
<!-- <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>-->
</span>
</div>
</div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
@ -280,11 +298,18 @@
<search-download class="uk-width-1-1@s uk-hidden@m" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
<div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-large-bottom">
<search-result [results]="results"
<search-result *ngIf="usedBy == 'search'" [results]="results"
[status]=searchUtils.status
[type]="entityType"
[showLoading]="true" [(properties)]=properties>
[showLoading]="true" [properties]=properties>
</search-result>
<deposit-result *ngIf="usedBy == 'deposit'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[zenodoInformation]="zenodoInformation"
[properties]=properties>
</deposit-result>
</div>
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
@ -300,7 +325,7 @@
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div>
<a *ngIf="properties.showLastIndexInformationLink" class="last_index_info uk-button-text"
<a *ngIf="properties.showLastIndexInformationLink && lastIndex" class="last_index_info uk-button-text"
[href]="properties.lastIndexInformationLink" target="_blank">
Last index information
</a>

View File

@ -17,6 +17,7 @@ import {HelperService} from "../../utils/helper/helper.service";
import {SearchFields} from "../../utils/properties/searchFields";
import {RefineResultsUtils} from "../../services/servicesUtils/refineResults.class";
import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class";
import {ZenodoInformationClass} from "../../deposit/utils/zenodoInformation.class";
@Component({
selector: 'new-search-page',
@ -60,6 +61,8 @@ export class NewSearchPageComponent {
@Input() showRefine: boolean = true;
@Input() tableViewLink: string;
@Input() usedBy: string = "search";
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@Input() showLastIndex: boolean = true;
@Input() showResultCount: boolean = true;
@Input() showMoreFilterValuesInline: boolean = true;
@Input() filterValuesNum: number = 6;
@ -663,14 +666,37 @@ export class NewSearchPageComponent {
}
}
if (doisParams.length > 0) {
params += this.createQuotedKeywordQuery(this.selectedFields[i],countParams,true, true) + " or " + doisParams;
params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId ,countParams,true, true) + " or " + doisParams;
} else {
params += this.createQuotedKeywordQuery(this.selectedFields[i],countParams,true);
params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId,countParams,true);
}
//TODO deposit case
console.log(this.usedBy)
console.log(this.keywordFields)
if(this.usedBy == "deposit") {
if(this.keywordFields.length > 0) {
params += " or ("
}
for(let j=0; j< this.keywordFields.length ; j++) {
if(j > 0) {
params += " or "
}
params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.keywordFields[j].name, " or ", countParams,false);
// let field = this.keywordFields[i];
//keywordQuery += field.name+field.equalityOperator+StringUtils.URIEncode(keyword);
// params += field.name+field.equalityOperator+StringUtils.quote(StringUtils.URIEncode(keyword));
}
if(this.keywordFields.length > 0) {
params += " ) "
}
}
} 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 if(this.fieldIdsMap[this.selectedFields[i].id].equalityOperator == "=") {
params+=this.createQuotedKeywordQuery(this.selectedFields[i], countParams, false);
params+=this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, 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) + '"' + " ";
@ -688,26 +714,26 @@ export class NewSearchPageComponent {
return params;
}
createQuotedKeywordQuery(field:AdvancedField, countParams:number, isSearchAll:boolean, forceQuotted:boolean=false){
createQuotedKeywordQuery(fieldValue, fieldId, fieldOperator, countParams:number, isSearchAll:boolean, forceQuotted:boolean=false){
let params = "";
let quotedParts = (field.value)?field.value.match(/(["'])(.*?)*?\1/g):[];
params+= (countParams == 0 ? "" : field.operatorId) + " (";
let quotedParts = (fieldValue)?fieldValue.match(/(["'])(.*?)*?\1/g):[];
params+= (countParams == 0 ? "" : fieldOperator) + " (";
if(forceQuotted){
return this.getQuotedQueryPart(field.id, '"'+ field.value+'"',isSearchAll);
return this.getQuotedQueryPart(fieldId, '"'+ fieldValue+'"',isSearchAll);
}
if(quotedParts && quotedParts.length == 1 && quotedParts[0] == field.value ){
params+=this.getQuotedQueryPart(field.id, field.value,isSearchAll);
if(quotedParts && quotedParts.length == 1 && quotedParts[0] == fieldValue ){
params+=this.getQuotedQueryPart(fieldId, fieldValue,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);
params+=this.getQuotedQueryPart(fieldId, 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<quotedParts.length)? field.value.indexOf(quotedParts[i+1]):field.value.length;
// console.log(field.value.indexOf(quotedParts[i+1]) +" - "+field.value.length);
let index = fieldValue.indexOf(quotedParts[i]);
endPoint = (i+1<quotedParts.length)? fieldValue.indexOf(quotedParts[i+1]):fieldValue.length;
// console.log(fieldValue.indexOf(quotedParts[i+1]) +" - "+fieldValue.length);
// console.log(" SP "+ startPoint+" EP: "+endPoint);
if(index==startPoint){
startPoint +=quotedParts[i].length;
@ -715,31 +741,31 @@ export class NewSearchPageComponent {
endPoint = index;
}
// console.log(" SP "+ startPoint+" EP: "+endPoint);
if(decodeURIComponent(field.value.substring(startPoint,endPoint)).split(" ").join("").length > 0) {
params += " and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint, endPoint), isSearchAll);
if(decodeURIComponent(fieldValue.substring(startPoint,endPoint)).split(" ").join("").length > 0) {
params += " and " + this.getNoQuotedQueryPart(fieldId, fieldValue.substring(startPoint, endPoint), isSearchAll);
}
// console.log("For "+i+" " +params+" SP "+ startPoint+" EP: "+endPoint);
// startPoint = (i+1<quotedParts.length)? field.value.indexOf(quotedParts[i+i]):field.value.length;//(startPoint<index )?(index + quotedParts[i].length):field.value.length;
startPoint = ((i+1<quotedParts.length)?(field.value.indexOf(quotedParts[i+1])+quotedParts[i+1].length):(endPoint== index?(index+quotedParts[i].length):endPoint));
// startPoint = (i+1<quotedParts.length)? fieldValue.indexOf(quotedParts[i+i]):fieldValue.length;//(startPoint<index )?(index + quotedParts[i].length):fieldValue.length;
startPoint = ((i+1<quotedParts.length)?(fieldValue.indexOf(quotedParts[i+1])+quotedParts[i+1].length):(endPoint== index?(index+quotedParts[i].length):endPoint));
}
if(startPoint !=field.value.length && decodeURIComponent(field.value.substring(startPoint,field.value.length)).split(" ").join("").length > 0){
params+=" and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint,field.value.length),isSearchAll);
if(startPoint !=fieldValue.length && decodeURIComponent(fieldValue.substring(startPoint,fieldValue.length)).split(" ").join("").length > 0){
params+=" and " + this.getNoQuotedQueryPart(fieldId, fieldValue.substring(startPoint,fieldValue.length),isSearchAll);
}
}else{
params+=this.getNoQuotedQueryPart(field.id, field.value,isSearchAll);
params+=this.getNoQuotedQueryPart(fieldId, fieldValue,isSearchAll);
}
params += " )";
return params;
}
private getQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
return " ("+(isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value)+")";
return (isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value);
}
private getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
if(isSearchAll){
return " (" + value + ")"
return value ;
}else{
return " ("+fieldId+"="+ StringUtils.URIEncode(value)+")";
return fieldId+"="+ StringUtils.URIEncode(value);
}
}
@ -751,6 +777,7 @@ export class NewSearchPageComponent {
getSearchAPIQueryForRefineFields(URLparams, firstLoad: boolean) {
var allFqs = "";
console.log(this.refineFields)
for (var i = 0; i < this.refineFields.length; i++) {
var filterId = this.refineFields[i];
@ -1246,12 +1273,15 @@ export class NewSearchPageComponent {
* @param fieldIds
* @param selectedFields
* @param refineFields
* @param rangeFields
* @param fieldIdsMap
* @param customFilter
* @param params
* @param entityType
* @param quickFilter
*/
prepareSearchPage(fieldIds, selectedFields, refineFields, rangeFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null){
//console.log("prepareSearchPage");
console.log(this.refineFields);
this.entityType = entityType;
this.fieldIds = fieldIds;
this.selectedFields = selectedFields;

View File

@ -51,7 +51,7 @@
</div>
</div!-->
<div class="uk-container">
<div class="uk-container uk-container-large">
<helper position="top"></helper>
<div class="uk-width-2-3@m uk-width-2-3@l uk-width-1-1@s">
@ -99,17 +99,18 @@
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<span *ngIf="searchViewLink" class="uk-width-expand">
<!-- <span *ngIf="searchViewLink" class="uk-width-expand">
<p>
<span uk-tooltip="title: Table view" class=" uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg>
</span>
<a uk-tooltip="title: List view" routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
List view
</a>
<search-dataprovider-map [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</p>
</span>
</span>-->
</div>
</div>
@ -163,7 +164,7 @@
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<span *ngIf="searchViewLink" class="uk-width-expand">
<!-- <span *ngIf="searchViewLink" class="uk-width-expand">
<p>
<span uk-tooltip="title: Table view" class=" uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
@ -172,7 +173,7 @@
</a>
<search-dataprovider-map class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</p>
</span>
</span>-->
</div>
</div>
@ -183,9 +184,21 @@
<div class="uk-width-expand@m uk-width-1-1@s uk-first-column custom-dataTable-content" >
<div *ngIf="openaireLink"> <a class="uk-margin-top uk-button uk-button-text" [href]=openaireLink target="_blank" >Results in OpenAIRE</a></div>
<div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom">
<div class="uk-margin-top uk-margin-bottom">
<search-results-per-page class="uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page>
<div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom ">
<div class="uk-grid">
<div class="uk-width-expand@m uk-grid uk-grid-medium uk-margin-small-bottom">
<search-results-per-page class="uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page>
</div>
<div class="uk-flex uk-flex-middle uk-width-auto@m uk-margin-small-bottom">
<span *ngIf="searchViewLink" class="uk-width-expand">
<a uk-tooltip="title: List view" routerLinkActive="router-link-active" [class]="((disableForms
&& !enableSearchView)?'uk-disabled uk-link-muted':'') +'uk-link-text'"
[routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
List view
</a>
</span>
</div>
</div>
<div class="searchPaging uk-panel uk-margin-top uk-margin-bottom uk-grid">
<span class="uk-width-1-1@s uk-width-1-2@m">

View File

@ -36,9 +36,8 @@ export class SearchDataprovidersService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
}
//((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any {
// &type=datasources
let url = properties.searchAPIURLLAst+"resources2/?format=json";
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, depositQuery:boolean = false ):any {
let url = properties.searchAPIURLLAst+"resources"+(depositQuery?'':2)+"/?format=json";
if(params!= null && params != '' ) {
url +="&query=(" + params + ")";
@ -358,7 +357,7 @@ export class SearchDataprovidersService {
let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
if(subject.content) {
if(subject && subject.content) {
subjects.push(subject.content);
}
}

View File

@ -240,7 +240,10 @@ export class EntitiesAutocompleteComponent {
}
showItem(item:any):string{
//console.log(item);
if (item.projectName || item.projectAcronym || item.code){ //project
if(!item){
return "[No title available]"
}
else if (item.projectName || item.projectAcronym || item.code){ //project
return ((item.projectAcronym)?"["+item.projectAcronym+"] ":"")+item.projectName+((item.code)?" ("+item.code+")":"");
}else if (item.name){ //search
return item.name;