veza/veza-backend-api/internal/elasticsearch/mappings.go
senke 41b5f6c455
Some checks failed
Veza CI / Backend (Go) (push) Waiting to run
Veza CI / Frontend (Web) (push) Waiting to run
Veza CI / Notify on failure (push) Blocked by required conditions
Security Scan / Secret Scanning (gitleaks) (push) Failing after 3m4s
Veza CI / Rust (Stream Server) (push) Has been cancelled
Backend API CI / test-integration (push) Failing after 11m59s
Backend API CI / test-unit (push) Failing after 12m1s
style(backend): gofmt -w on 85 files (whitespace only)
backend-ci.yml's `test -z "$(gofmt -l .)"` strict gate (added in
c96edd692) failed on a backlog of unformatted files. None of the
85 files in this commit had been edited since the gate was added
because no push touched veza-backend-api/** in between, so the
gate never fired until today's CI fixes triggered it.

The diff is exclusively whitespace alignment in struct literals
and trailing-space comments. `go build ./...` and the full test
suite (with VEZA_SKIP_INTEGRATION=1 -short) pass identically.
2026-04-14 12:22:14 +02:00

131 lines
3.2 KiB
Go

package elasticsearch
// Index names (F361, F362)
const (
IdxTracks = "tracks"
IdxUsers = "users"
IdxPlaylists = "playlists"
)
// Track mapping: title, artist, tags, genre, description (F361)
// Multi-field with fuzziness for typo tolerance (F364)
const tracksMapping = `{
"settings": {
"analysis": {
"analyzer": {
"veza_text": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "asciifolding"]
}
},
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"properties": {
"id": { "type": "keyword" },
"title": {
"type": "text",
"analyzer": "veza_text",
"fields": {
"keyword": { "type": "keyword" },
"fuzzy": {
"type": "text",
"analyzer": "veza_text"
}
}
},
"artist": {
"type": "text",
"analyzer": "veza_text",
"fields": {
"keyword": { "type": "keyword" }
}
},
"description": {
"type": "text",
"analyzer": "veza_text"
},
"album": {
"type": "text",
"analyzer": "veza_text",
"fields": { "keyword": { "type": "keyword" } }
},
"genre": { "type": "keyword" },
"tags": { "type": "keyword" },
"created_at": { "type": "date" },
"cover_art_path": { "type": "keyword", "index": false },
"stream_manifest_url": { "type": "keyword", "index": false },
"file_path": { "type": "keyword", "index": false }
}
}
}`
// User mapping: username, display_name, bio (F362)
const usersMapping = `{
"settings": {
"analysis": {
"analyzer": {
"veza_text": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "asciifolding"]
}
},
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"properties": {
"id": { "type": "keyword" },
"username": {
"type": "text",
"analyzer": "veza_text",
"fields": { "keyword": { "type": "keyword" } }
},
"display_name": {
"type": "text",
"analyzer": "veza_text",
"fields": { "keyword": { "type": "keyword" } }
},
"bio": { "type": "text", "analyzer": "veza_text" },
"location": { "type": "keyword" },
"avatar": { "type": "keyword", "index": false },
"created_at": { "type": "date" }
}
}
}`
// Playlist mapping (F363)
const playlistsMapping = `{
"settings": {
"analysis": {
"analyzer": {
"veza_text": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "asciifolding"]
}
},
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"properties": {
"id": { "type": "keyword" },
"name": {
"type": "text",
"analyzer": "veza_text",
"fields": { "keyword": { "type": "keyword" } }
},
"description": { "type": "text", "analyzer": "veza_text" },
"visibility": { "type": "keyword" },
"cover_url": { "type": "keyword", "index": false },
"created_at": { "type": "date" }
}
}
}`