Improve cross-entity search with weighted ranking, prefix matching, and richer results
Backend: Use ts_rank_cd with A/D weights so name matches rank above description matches. Switch to 'simple' text search config with :* prefix suffix for partial word matching (e.g. "toma" finds "Tomate"). Include bilingual DE/EN fields in search vectors. Cultivar search JOINs species so "tomato" finds tomato cultivars. Return extra metadata: plant_layer, food_uses, species_name, is_organic, snippet. Frontend: Show colored entity type badges (Familie/Art/Sorte). Display localized common names, plant layer tags, food uses for species, species link + organic badge for cultivars, and truncated description snippets. Add DE/EN i18n keys for search result type labels.
This commit is contained in:
+242
-26
@@ -601,23 +601,80 @@ tr:hover td {
|
||||
border-radius: var(--radius);
|
||||
padding: 0.75rem 1rem;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.result-type {
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
flex-shrink: 0;
|
||||
.search-result-header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.search-result-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.badge-family {
|
||||
background: #e8eaf6;
|
||||
color: #283593;
|
||||
}
|
||||
|
||||
.badge-species {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
}
|
||||
|
||||
.badge-cultivar {
|
||||
background: #fff3e0;
|
||||
color: #e65100;
|
||||
}
|
||||
|
||||
.badge-meta {
|
||||
background: var(--accent-light);
|
||||
color: var(--text-muted);
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
.result-scientific {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.result-cultivar-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.result-common-name {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.result-species-link {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.result-species-link em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.result-uses {
|
||||
font-size: 0.82rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.result-desc {
|
||||
width: 100%;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* Table toolbar (search + per-page on same row) */
|
||||
@@ -1027,7 +1084,11 @@ tr:hover td {
|
||||
}
|
||||
|
||||
.stats-row {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.quick-filters {
|
||||
@@ -1040,12 +1101,6 @@ tr:hover td {
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.stats-row {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* 404 */
|
||||
|
||||
.not-found {
|
||||
@@ -1361,43 +1416,204 @@ td.placeholder {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* ── Bottom navigation (mobile only) ──────────────────────── */
|
||||
|
||||
.bottom-nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
|
||||
@media (max-width: 768px) {
|
||||
/* Hide sidebar completely on mobile */
|
||||
.sidebar {
|
||||
width: 60px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar-brand,
|
||||
.sidebar-user,
|
||||
.brand-text-group {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-label {
|
||||
display: none;
|
||||
/* Show bottom nav */
|
||||
.bottom-nav {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
background: var(--bg-sidebar);
|
||||
border-top: 1px solid rgba(255,255,255,0.1);
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 0.35rem 0;
|
||||
padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
.bottom-nav-link {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.15rem;
|
||||
color: rgba(255,255,255,0.55);
|
||||
text-decoration: none;
|
||||
font-size: 0.6rem;
|
||||
padding: 0.25rem 0.4rem;
|
||||
border-radius: 4px;
|
||||
transition: color 0.15s;
|
||||
min-width: 44px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bottom-nav-link:hover,
|
||||
.bottom-nav-link:active {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.bottom-nav-icon {
|
||||
font-size: 1.25rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.bottom-nav-label {
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
/* Language toggle in bottom nav */
|
||||
.bottom-nav .lang-toggle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.bottom-nav .lang-btn {
|
||||
padding: 0.2rem 0.45rem;
|
||||
font-size: 0.65rem;
|
||||
}
|
||||
|
||||
/* Content adjustments */
|
||||
.content {
|
||||
padding: 1.5rem;
|
||||
padding: 1rem;
|
||||
margin-left: 0;
|
||||
padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
/* Cards */
|
||||
.card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
/* Info grid */
|
||||
.info-grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
/* Detail page two-column → single column */
|
||||
.detail-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
/* Tables: scrollable + smaller text */
|
||||
.table-wrap {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 0.45rem 0.6rem;
|
||||
}
|
||||
|
||||
.attr-table th {
|
||||
width: auto;
|
||||
min-width: 100px;
|
||||
min-width: 90px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.attr-table td {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.cell-truncated {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
/* Filter bar: stack vertically */
|
||||
.filter-bar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.filter-group {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.filter-group select {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Table toolbar: stack */
|
||||
.table-toolbar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.table-toolbar .search-bar {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* Column toggle: scroll horizontally */
|
||||
.column-toggle {
|
||||
overflow-x: auto;
|
||||
flex-wrap: nowrap;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* 52-week calendar: horizontal scroll */
|
||||
.planting-calendar {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.wcal-month-row,
|
||||
.wcal-row {
|
||||
min-width: 500px;
|
||||
}
|
||||
|
||||
.wcal-legend {
|
||||
padding-left: 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* Hero */
|
||||
h1 {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
.pagination {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.pagination button {
|
||||
padding: 0.35rem 0.75rem;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* Search results */
|
||||
.search-result {
|
||||
padding: 0.6rem 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user