fix meilisearch

This commit is contained in:
2026-03-26 22:00:42 +01:00
parent 29260080c2
commit ec05101037
21 changed files with 545 additions and 294 deletions

View File

@@ -1,5 +1,7 @@
package model
import "encoding/json"
// ProductDescription contains all the information visible on webpage, in given language.
type ProductDescription struct {
ProductID uint `gorm:"column:id_product;primaryKey" json:"product_id" form:"product_id"`
@@ -28,20 +30,30 @@ type ProductRow struct {
}
type MeiliSearchProduct struct {
ProductID uint `gorm:"column:id_product"`
Name string `gorm:"column:name"`
Description string `gorm:"column:description"`
DescriptionShort string `gorm:"column:description_short"`
Usage string `gorm:"column:used_for"`
EAN13 string `gorm:"column:ean13"`
Reference string `gorm:"column:reference"`
Width float64 `gorm:"column:width"`
Height float64 `gorm:"column:height"`
Depth float64 `gorm:"column:depth"`
Weight float64 `gorm:"column:weight"`
CategoryID uint `gorm:"column:id_category"`
CategoryName string `gorm:"column:category_name"`
Variations uint `gorm:"column:variations"`
CategoryIDs []uint `gorm:"-"` // All category IDs including children for filtering
CoverImage string `gorm:"-"` // Cover image URL (not indexed)
ProductID uint `gorm:"column:id_product" json:"product_id"`
Name string `gorm:"column:name" json:"name"`
Active uint8 `gorm:"column:active" json:"active"`
Description string `gorm:"column:description" json:"description"`
DescriptionShort string `gorm:"column:description_short" json:"description_short"`
Usage string `gorm:"column:used_for" json:"usage"`
EAN13 string `gorm:"column:ean13" json:"ean13"`
Reference string `gorm:"column:reference" json:"reference"`
Price float64 `gorm:"column:price" json:"price"`
CategoryID uint `gorm:"column:id_category" json:"category_id"`
CategoryName string `gorm:"column:category_name" json:"category_name"`
Variations uint `gorm:"column:variations" json:"variations"`
// JSON fields stored as raw, converted to string for search
Attributes json.RawMessage `gorm:"column:attributes" json:"attributes"`
Features json.RawMessage `gorm:"column:features" json:"features"`
AttributeFilters json.RawMessage `gorm:"column:attribute_filters" json:"attribute_filters"`
// String versions for searchable text (populated during indexing)
FeaturesStr string `json:"features_str"`
AttributesStr string `json:"attributes_str"`
AttributeFiltersStr string `json:"attribute_filters_str"`
CategoryIDs json.RawMessage `gorm:"column:category_ids" json:"category_ids"` // All category IDs including children for filtering
IDImage uint `gorm:"column:id_image" json:"id_image"` // Cover image ID (not indexed)
CoverImage string `json:"cover_image"` // Cover image URL (populated during indexing)
}