backend-ci.yml's `test -z "$(gofmt -l .)"` strict gate (added in
13c21ac11) 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.
131 lines
3.2 KiB
Go
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" }
|
|
}
|
|
}
|
|
}`
|