feature/keywords-analysis #291

Merged
genja merged 7 commits from feature/keywords-analysis into dev 2026-08-17 23:17:25 +02:00
19 changed files with 406 additions and 509 deletions
@@ -508,7 +508,7 @@ def _eu_sort_field(sort_by: str) -> str:
"id": "id",
"project_type": "_index",
}
return mapping.get(sort_by, "title.keyword")
return mapping.get(sort_by, "")
async def get_eu_project_ids_by_organization_filters(
@@ -959,7 +959,7 @@ async def search_eu_cordis_projects(
framework_programmes: list[str] | None = None,
funding_schemes: list[str] | None = None,
statuses: list[str] | None = None,
sort_by: str = "title",
sort_by: str = "",
sort_direction: str = "asc",
fuzzy: bool = False,
skip_enrichment: bool = False,
@@ -364,7 +364,7 @@ async def search_dfg_projects(
title: str | None = None,
funding_start_years: list[str] | None = None,
funding_end_years: list[str] | None = None,
sort_by: str = "id",
sort_by: str = "",
sort_direction: str = "asc",
fuzzy: bool = False,
skip_enrichment: bool = False,
@@ -435,64 +435,89 @@ async def search_dfg_projects(
elif keywords:
keyword_clauses = []
#Add highlighting for the title and abstract fields
title_abstract_query = {
"bool": {
"should": [
{
"multi_match": {
"query": keyword,
"fields": ["title_de", "title_en", "abstract_de", "abstract_en"],
"type": "phrase_prefix",
"max_expansions": 100,
}
}
for keyword in keywords if keyword.strip()
],
"minimum_should_match": 1,
}
}
body["highlight"] = {
"fragment_size": 200,
"number_of_fragments": 0,
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
"require_field_match": True,
"fields": {
"title_de": {"highlight_query": title_abstract_query},
"title_en": {"highlight_query": title_abstract_query},
"abstract_de": {"highlight_query": title_abstract_query},
"abstract_en": {"highlight_query": title_abstract_query},
},
}
for keyword in keywords:
if keyword.strip() == "":
continue
keyword_clauses.append(
{
keyword_clauses.append({
"bool": {
"should": [
{
"multi_match": {
"query": keyword,
"fields": [
"title_de",
"title_en",
"abstract_de",
"abstract_en",
],
"query": keyword,
"fields": ["title_de^4", "title_en^4", "abstract_de^2", "abstract_en^2"],
"type": "phrase_prefix",
"max_expansions": 100,
}
},
{
"nested": {
"path": "subject_classifications",
"query": {
"multi_match": {
"query": keyword,
"fields": [
"subject_classifications.fach",
"subject_classifications.fachkollegium",
"subject_classifications.fachgebiet",
"subject_classifications.fachgebiet_de",
"subject_classifications.wissenschaftsbereich",
],
"type": "phrase_prefix",
"max_expansions": 100,
}
},
"inner_hits": {
"name": keyword,
"highlight": {
"fields": {
"subject_classifications.fach": {},
"subject_classifications.fachkollegium": {},
"subject_classifications.fachgebiet": {},
"subject_classifications.fachgebiet_de": {},
"subject_classifications.wissenschaftsbereich": {},
"nested": {
"path": "subject_classifications",
"query": {
"multi_match": {
"query": keyword,
"fields": [
"subject_classifications.fach^4",
"subject_classifications.fachkollegium^4",
"subject_classifications.fachgebiet^4",
"subject_classifications.fachgebiet_de^4",
"subject_classifications.wissenschaftsbereich^4",
],
"type": "phrase_prefix",
"max_expansions": 100,
}
}
},
}
},
},
"inner_hits": {
"name": keyword,
"highlight": {
"fields": {
"subject_classifications.fach": {},
"subject_classifications.fachkollegium": {},
"subject_classifications.fachgebiet": {},
"subject_classifications.fachgebiet_de": {},
"subject_classifications.wissenschaftsbereich": {},
}
}
},
}
},
],
"minimum_should_match": 1,
"minimum_should_match": 1,
}
}
)
})
if keyword_clauses:
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
if filter_topic_ids:
@@ -634,25 +659,13 @@ async def search_dfg_projects(
elif sort_by == "professional_classification":
sort_config = {"subject_area_de.keyword": {"order": sort_direction}}
else:
sort_config = {"id": {"order": sort_direction}}
sort_config = {"_score": {"order": "desc"}}
body["sort"] = [sort_config]
#Add highlighting for the title and abstract fields
body["highlight"] = {
"fields": {
"title_de": {},
"title_en": {},
"abstract_de": {},
"abstract_en": {},
},
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
"require_field_match": True,
}
# print(f"Executing DFG project search with body: {json.dumps(body, indent=2)}")
# === Execute Search ===
# print(f"Executing DFG project search with body: {body}")
print(f"Executing DFG project search with body: {body}")
response = await elasticsearch.search(
index=ESIndex.DFG_PROJECTS,
body=body,
@@ -909,7 +922,7 @@ async def search_bund_projects_with_filters(
countries: list[str] | None = None,
page: int = 0,
size: int = 10,
sort_by: str = "title",
sort_by: str = "",
sort_direction: str = "asc",
fuzzy: bool = False,
skip_topic_enrichment: bool = False,
@@ -993,19 +1006,31 @@ async def search_bund_projects_with_filters(
elif keywords:
keyword_clauses = []
#Add highlighting for the title and abstract fields
body["highlight"] = {
"fields": {
"Verbundprojekt": {},
"Thema": {},
"Zuwendungsempfänger": {},
"Ausführende Stelle": {},
},
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
"require_field_match": True,
}
for kw in keywords:
if kw.strip() == "":
continue
keyword_clauses.append({
"multi_match": {
"query": kw,
"fields": ["Verbundprojekt","Thema"], # searching title/acronym field
"fields": ["Verbundprojekt^4","Thema^4"],
"type": "phrase_prefix",
"max_expansions": 100,
}
})
if keyword_clauses:
must_clauses.append({"bool": {"must": keyword_clauses}})
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
if filter_topic_ids:
@@ -1071,7 +1096,7 @@ async def search_bund_projects_with_filters(
sort_direction = sort_direction.strip().lower()
if sort_direction not in ("asc", "desc"):
sort_direction = "asc"
sort_config = {}
if sort_by == "title":
sort_config = {"Verbundprojekt.keyword": {"order": sort_direction}}
elif sort_by == "funding_start":
@@ -1079,22 +1104,9 @@ async def search_bund_projects_with_filters(
elif sort_by == "funding_end":
sort_config = {"funding_end": {"order": sort_direction}}
else:
# Fallback to project ID
sort_config = {"Förderkennzeichen.keyword": {"order": sort_direction}}
sort_config = "_score"
body["sort"] = [sort_config]
#Add highlighting for the title and abstract fields
body["highlight"] = {
"fields": {
"Verbundprojekt": {},
"Thema": {},
"Zuwendungsempfänger": {},
"Ausführende Stelle": {},
},
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
"require_field_match": True,
}
# print(f"Executing BUND project search with body: {json.dumps(body, indent=2)}")
# === Execute Search ===
response = await elasticsearch.search(
+3 -3
View File
@@ -114,7 +114,7 @@ async def get_dfg_projects(
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
sort_by: Annotated[str, Query(description="The field to sort by.")] = "title",
sort_by: Annotated[str, Query(description="The field to sort by.")] = "",
sort_direction: Annotated[
str, Query(description="The sort direction (asc or desc).")
] = "asc",
@@ -255,7 +255,7 @@ async def search_bund_projects(
] = None,
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
sort_by: Annotated[str, Query(description="Sort field.")] = "title",
sort_by: Annotated[str, Query(description="Sort field.")] = "",
sort_direction: Annotated[
str,
Query(description="Sort direction: asc or desc."),
@@ -409,7 +409,7 @@ async def search_eu_cordis_projects_endpoint(
] = None,
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
sort_by: Annotated[str, Query(description="Sort field.")] = "title",
sort_by: Annotated[str, Query(description="Sort field.")] = "",
sort_direction: Annotated[
str,
Query(description="Sort direction: asc or desc."),
+3 -3
View File
@@ -184,7 +184,7 @@ async def get_dfg_projects(
funding_end_years: list[str] | None,
page: int,
size: int,
sort_by: str = "topic",
sort_by: str = "",
sort_direction: str = "asc",
fuzzy: bool = False,
skip_enrichment: bool = False,
@@ -460,7 +460,7 @@ async def search_bund_projects_with_filters(
countries: list[str] | None,
page: int,
size: int,
sort_by: str = "title",
sort_by: str = "",
sort_direction: str = "asc",
fuzzy: bool = False,
active_from_year: int | None = None,
@@ -670,7 +670,7 @@ async def search_eu_cordis_projects(
framework_programmes: list[str] | None = None,
funding_schemes: list[str] | None = None,
statuses: list[str] | None = None,
sort_by: str = "title",
sort_by: str = "",
sort_direction: str = "asc",
fuzzy: bool = False,
skip_enrichment: bool = False,
@@ -58,8 +58,9 @@ export const bundProjectsResolver: ResolveFn<BundProjectPage> = (
const fundingType = route.queryParamMap.getAll(
bundProjectQueryParamKeys.funding_type,
);
const sortBy = (route.queryParamMap.get(bundProjectQueryParamKeys.sortBy) ||
'title') as ProjectsSortBy;
const sortBy = route.queryParamMap.get(
bundProjectQueryParamKeys.sortBy,
) as ProjectsSortBy;
const sortDirection = (route.queryParamMap.get(
bundProjectQueryParamKeys.sortDirection,
) || 'asc') as SortDirection;
@@ -83,7 +84,7 @@ export const bundProjectsResolver: ResolveFn<BundProjectPage> = (
undefined,
Number(page),
Number(size),
sortBy,
sortBy || '',
sortDirection,
fuzzySearch,
);
@@ -107,7 +108,7 @@ export const bundProjectsResolver: ResolveFn<BundProjectPage> = (
oaInstitutionId,
Number(page),
Number(size),
sortBy,
sortBy || 'title',
sortDirection,
fuzzySearch,
);
@@ -47,8 +47,7 @@ export const dfgProjectsResolver: ResolveFn<DfgProjectPage> = (
const searchTerm =
route.queryParamMap.get(dfgProjectQueryParamKeys.title) ?? undefined;
const sortBy =
route.queryParamMap.get(dfgProjectQueryParamKeys.sortBy) || 'title';
const sortBy = route.queryParamMap.get(dfgProjectQueryParamKeys.sortBy);
const sortDirection =
route.queryParamMap.get(dfgProjectQueryParamKeys.sortDirection) || 'asc';
@@ -84,7 +83,7 @@ export const dfgProjectsResolver: ResolveFn<DfgProjectPage> = (
fundingEnd,
page,
size,
sortBy,
sortBy || 'title',
sortDirection,
false,
);
@@ -105,7 +104,7 @@ export const dfgProjectsResolver: ResolveFn<DfgProjectPage> = (
fundingEnd,
page,
size,
sortBy,
sortBy || '',
sortDirection,
fuzzySearch,
);
@@ -131,7 +130,7 @@ export const dfgProjectsResolver: ResolveFn<DfgProjectPage> = (
fundingEnd,
page,
size,
sortBy,
sortBy || 'title',
sortDirection,
false,
);
@@ -70,8 +70,7 @@ export const euCordisProjectsResolver: ResolveFn<EuCordisProjectSearchPage> = (
const searchTerm =
route.queryParamMap.get(euProjectQueryParamKeys.title) ?? undefined;
const sortBy =
route.queryParamMap.get(euProjectQueryParamKeys.sortBy) || 'title';
const sortBy = route.queryParamMap.get(euProjectQueryParamKeys.sortBy);
const sortDirection =
route.queryParamMap.get(euProjectQueryParamKeys.sortDirection) || 'asc';
@@ -143,7 +142,7 @@ export const euCordisProjectsResolver: ResolveFn<EuCordisProjectSearchPage> = (
statuses,
page,
size,
sortBy,
sortBy || 'title',
sortDirection,
false,
);
@@ -173,7 +172,7 @@ export const euCordisProjectsResolver: ResolveFn<EuCordisProjectSearchPage> = (
statuses,
page,
size,
sortBy,
sortBy || '',
sortDirection,
fuzzySearch,
);
@@ -207,7 +206,7 @@ export const euCordisProjectsResolver: ResolveFn<EuCordisProjectSearchPage> = (
statuses,
page,
size,
sortBy,
sortBy || 'title',
sortDirection,
false,
);
@@ -110,58 +110,64 @@
<ng-template #expandedProject let-project>
@if (project.highlight) {
@let highlight = project.highlight;
<section class="project-panel" aria-label="Weitere Projektdetails">
<div class="project-panel__content">
@if (highlight.topic.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.topic"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.topic))
" />
</article>
}
@if (highlight.recipient.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zuwendungsempfänger</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.recipient"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.recipient))
" />
</article>
}
@if (highlight.joint_project.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Verbundprojekt</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.joint_project"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.joint_project)
)
" />
</article>
}
@if (highlight.executing_agency.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Ausführende Stelle</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.executing_agency"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.executing_agency)
)
" />
</article>
}
<app-table-detail-row>
<div table-detail-header>
<h4 class="panel-field__label">Fundstelle im Projekt</h4>
</div>
</section>
<ng-container table-detail-body>
<div class="project-panel__content">
@if (highlight.topic.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.topic"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.topic))
" />
</article>
}
@if (highlight.recipient.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zuwendungsempfänger</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.recipient"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.recipient))
" />
</article>
}
@if (highlight.joint_project.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Verbundprojekt</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.joint_project"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.joint_project)
)
" />
</article>
}
@if (highlight.executing_agency.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Ausführende Stelle</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.executing_agency"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.executing_agency)
)
" />
</article>
}
</div>
</ng-container>
</app-table-detail-row>
}
</ng-template>
@@ -205,97 +205,6 @@
}
}
}
// ------------------------
// Expanded project panel
// ------------------------
.project-panel {
width: 100%;
padding: 12px 16px 14px;
color: var(--sg-text);
background: var(--sg-background);
border-top: 1px solid var(--sg-border);
}
.project-panel__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.project-panel__heading {
display: flex;
align-items: flex-start;
gap: 8px;
> mat-icon {
flex: 0 0 auto;
width: 19px;
height: 19px;
color: var(--sg-primary);
font-size: 19px;
}
h3 {
margin: 0;
font-size: 13px;
font-weight: 700;
line-height: 1.2;
}
p {
margin: 1px 0 0;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.3;
}
}
.project-panel__content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
gap: 10px;
}
.panel-field {
min-width: 0;
&--full {
grid-column: 1 / -1;
}
}
.panel-field__label {
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.panel-field__text {
margin: 0;
font-size: 12px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.project-panel__empty {
display: flex;
align-items: center;
gap: 6px;
grid-column: 1 / -1;
color: var(--sg-text-muted);
font-size: 12px;
mat-icon {
width: 16px;
height: 16px;
font-size: 16px;
}
}
// ------------------------
// Responsive adjustments
@@ -32,7 +32,7 @@ import {
HighlightedTextComponent,
HighlightTerm,
} from '../highlighted-text/highlighted-text.component';
import { MatDividerModule } from '@angular/material/divider';
import { TableDetailRowComponent } from '../table-detail-row/table-detail-row.component';
@Component({
selector: 'app-bund-project-table',
imports: [
@@ -49,6 +49,7 @@ import { MatDividerModule } from '@angular/material/divider';
AppTopicChipComponent,
SkTextDirective,
HighlightedTextComponent,
TableDetailRowComponent,
],
templateUrl: './bund-project-table.component.html',
styleUrl: './bund-project-table.component.scss',
@@ -65,29 +65,33 @@
<ng-template #expandedProject let-project>
@if (project.highlight) {
@let highlight = project.highlight;
<section class="project-panel" aria-label="Weitere Projektdetails">
<header class="project-panel__header">
<div class="language-toggle" role="group" aria-label="Sprache wählen">
<button
[disabled]="!hasDePanelContent(project)"
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'de'"
(click)="setPanelLanguage(project, 'de')">
DE
</button>
<button
[disabled]="!hasEnPanelContent(project)"
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'en'"
(click)="setPanelLanguage(project, 'en')">
EN
</button>
</div>
</header>
<mat-divider />
<div class="project-panel__content">
<app-table-detail-row>
<div table-detail-header>
<h4 class="panel-field__label">Fundstelle im Projekt</h4>
</div>
<ng-container table-detail-body>
<article>
<div class="language-toggle" role="group" aria-label="Sprache wählen">
<button
[disabled]="!hasDePanelContent(project)"
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'de'"
(click)="setPanelLanguage(project, 'de')">
DE
</button>
<button
[disabled]="!hasEnPanelContent(project)"
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'en'"
(click)="setPanelLanguage(project, 'en')">
EN
</button>
</div>
</article>
@if (getPanelLanguage(project) === 'de') {
@if (highlight.title_de.length > 0) {
<article class="panel-field panel-field--full">
@@ -161,8 +165,8 @@
}
</article>
}
</div>
</section>
</ng-container>
</app-table-detail-row>
}
</ng-template>
<ng-template #authorsTmp let-project>
@@ -296,6 +296,7 @@
.language-toggle {
display: inline-flex;
flex: 0 0 auto;
margin-top: 5px;
padding: 1px;
border: 1px solid var(--sg-border);
border-radius: 4px;
@@ -358,94 +359,6 @@
line-height: 1.4;
overflow-wrap: anywhere;
}
// ------------------------
// Expanded project panel
// ------------------------
.project-panel {
width: 100%;
padding: 12px 16px 14px;
color: var(--sg-text);
background: var(--sg-background);
border-top: 1px solid var(--sg-border);
}
.project-panel__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.project-panel__heading {
display: flex;
align-items: flex-start;
gap: 8px;
> mat-icon {
flex: 0 0 auto;
width: 19px;
height: 19px;
color: var(--sg-primary);
font-size: 19px;
}
h3 {
margin: 0;
font-size: 13px;
font-weight: 700;
line-height: 1.2;
}
p {
margin: 1px 0 0;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.3;
}
}
.project-panel__content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
gap: 10px;
}
.panel-field {
min-width: 0;
&--full {
grid-column: 1 / -1;
}
}
.panel-field__label {
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.panel-field__text {
margin: 0;
font-size: 12px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.project-panel__empty {
display: flex;
align-items: center;
gap: 6px;
grid-column: 1 / -1;
color: var(--sg-text-muted);
font-size: 12px;
mat-icon {
width: 16px;
height: 16px;
font-size: 16px;
}
.keka {
background: var(--sg-surface-soft);
}
@@ -30,6 +30,7 @@ import {
HighlightedTextComponent,
HighlightTerm,
} from '../highlighted-text/highlighted-text.component';
import { TableDetailRowComponent } from '../table-detail-row/table-detail-row.component';
import { MatDividerModule } from '@angular/material/divider';
type HighlightLanguage = 'de' | 'en';
@@ -47,6 +48,7 @@ type HighlightLanguage = 'de' | 'en';
SkTextDirective,
HighlightedTextComponent,
MatDividerModule,
TableDetailRowComponent,
],
templateUrl: './dfg-project-table.component.html',
styleUrl: './dfg-project-table.component.scss',
@@ -534,6 +536,7 @@ export class DfgProjectTableComponent implements OnInit {
}
}
}
console.log(terms);
return Array.from(terms);
}
@@ -150,67 +150,73 @@
<ng-template #expandedProject let-project>
@if (project.highlight) {
@let highlight = project.highlight;
<section class="project-panel" aria-label="Weitere Projektdetails">
<div class="project-panel__content">
@if (highlight.title.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.title))
" />
</article>
}
@if (highlight.objective.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zusammenfassung</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.objective"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.objective))
" />
</article>
}
@if (highlight.acronym.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Akronym</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.acronym"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.acronym))
" />
</article>
}
@if (highlight.cordis_topic_text.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Cordis-Thema</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.cordis_topic_text"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.cordis_topic_text)
)
" />
</article>
}
@if (highlight.keywords.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Schlüsselwörter</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.keywords"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.keywords))
" />
</article>
}
<app-table-detail-row>
<div table-detail-header>
<h4 class="panel-field__label">Fundstelle im Projekt</h4>
</div>
</section>
<ng-container table-detail-body>
<div class="project-panel__content">
@if (highlight.title.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.title))
" />
</article>
}
@if (highlight.objective.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zusammenfassung</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.objective"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.objective))
" />
</article>
}
@if (highlight.acronym.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Akronym</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.acronym"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.acronym))
" />
</article>
}
@if (highlight.cordis_topic_text.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Cordis-Thema</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.cordis_topic_text"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.cordis_topic_text)
)
" />
</article>
}
@if (highlight.keywords.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Schlüsselwörter</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.keywords"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.keywords))
" />
</article>
}
</div>
</ng-container>
</app-table-detail-row>
}
</ng-template>
@@ -143,97 +143,6 @@
max-width: 200px;
}
// ------------------------
// Expanded project panel
// ------------------------
.project-panel {
width: 100%;
padding: 12px 16px 14px;
color: var(--sg-text);
background: var(--sg-background);
border-top: 1px solid var(--sg-border);
}
.project-panel__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.project-panel__heading {
display: flex;
align-items: flex-start;
gap: 8px;
> mat-icon {
flex: 0 0 auto;
width: 19px;
height: 19px;
color: var(--sg-primary);
font-size: 19px;
}
h3 {
margin: 0;
font-size: 13px;
font-weight: 700;
line-height: 1.2;
}
p {
margin: 1px 0 0;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.3;
}
}
.project-panel__content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
gap: 10px;
}
.panel-field {
min-width: 0;
&--full {
grid-column: 1 / -1;
}
}
.panel-field__label {
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.panel-field__text {
margin: 0;
font-size: 12px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.project-panel__empty {
display: flex;
align-items: center;
gap: 6px;
grid-column: 1 / -1;
color: var(--sg-text-muted);
font-size: 12px;
mat-icon {
width: 16px;
height: 16px;
font-size: 16px;
}
}
// ------------------------
// Data table overrides (applied via ::ng-deep)
// ------------------------
@@ -39,6 +39,7 @@ import {
} from '../highlighted-text/highlighted-text.component';
import { MatDividerModule } from '@angular/material/divider';
import { SearchResultsStateService } from '../../../modules/keywords-search/search-results/search-results-state.service';
import { TableDetailRowComponent } from '../table-detail-row/table-detail-row.component';
@Component({
selector: 'app-eu-project-table',
imports: [
@@ -57,6 +58,7 @@ import { SearchResultsStateService } from '../../../modules/keywords-search/sear
SkTextDirective,
MatDividerModule,
HighlightedTextComponent,
TableDetailRowComponent,
],
templateUrl: './eu-project-table.component.html',
styleUrl: './eu-project-table.component.scss',
@@ -0,0 +1,11 @@
<section class="project-panel" aria-label="Detailansicht">
<header class="project-panel__header">
<ng-content select="[table-detail-header]"></ng-content>
</header>
<mat-divider />
<div class="project-panel__content">
<ng-content select="[table-detail-body]"></ng-content>
</div>
</section>
@@ -0,0 +1,111 @@
:host {
display: block;
width: 100%;
background: var(--sg-surface-soft);
}
.project-panel {
width: 100%;
padding: 12px 16px 14px;
color: var(--sg-text);
border-top: 1px solid var(--sg-border);
&__header {
display: flex;
align-items: flex-start;
justify-content: flex-start;
gap: 12px;
}
&__content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
gap: 10px;
}
}
// Use :host ::ng-deep to allow styles to pierce into the projected content
:host ::ng-deep {
.panel-field {
min-width: 0;
&--full {
grid-column: 1 / -1;
}
}
.panel-field__label {
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
margin: 0;
}
.panel-field__text {
margin: 0;
font-size: 12px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.project-panel__empty {
display: flex;
align-items: center;
gap: 6px;
grid-column: 1 / -1;
color: var(--sg-text-muted);
font-size: 12px;
mat-icon {
width: 16px;
height: 16px;
font-size: 16px;
}
}
.language-toggle {
display: inline-flex;
flex: 0 0 auto;
padding: 1px;
border: 1px solid var(--sg-border);
border-radius: 4px;
background: var(--sg-background);
&__button {
min-width: 27px;
padding: 2px 5px;
border: 0;
border-radius: 3px;
color: var(--sg-text-muted);
background: transparent;
font-family: inherit;
font-size: 9px;
font-weight: 700;
line-height: 1.4;
cursor: pointer;
&:hover,
&:focus-visible {
color: var(--sg-primary);
outline: none;
}
&.active {
color: var(--sg-background);
background: var(--sg-primary);
}
}
}
.language-label {
flex: 0 0 auto;
padding: 2px 5px;
border: 1px solid var(--sg-border);
border-radius: 3px;
color: var(--sg-text-muted);
background: var(--sg-background);
font-size: 9px;
font-weight: 700;
}
}
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { MatDividerModule } from '@angular/material/divider';
@Component({
selector: 'app-table-detail-row',
standalone: true,
imports: [MatDividerModule],
templateUrl: './table-detail-row.component.html',
styleUrls: ['./table-detail-row.component.scss'],
})
export class TableDetailRowComponent {}