feat(go-services): inventory-go search — object_class_name (exact, gem context)
Loads the ObjectClass enum map and adds object_class_name via translate_object_class, including the context-aware Gem(11) classification (crystal/mana stone/gem/aetheria by item name, using the original name before the material prefix). The rare aetheria-by-IntValues path is documented as not reproduced (needs original_json). Validated vs Python: 0 mismatches over 600 rows (3 queries incl. a 'crystal' text search that exercises the gem context) for object_class_name, name, material_name, item_set_name, value. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
50360f72c4
commit
1294ec4418
2 changed files with 58 additions and 14 deletions
|
|
@ -358,6 +358,12 @@ func (s *Server) enrichRows(rows []map[string]any) []map[string]any {
|
|||
row["last_updated"] = pyISO(t)
|
||||
}
|
||||
|
||||
// object_class_name — gem(11) context uses the ORIGINAL item name, so
|
||||
// compute before the material prefix below (translate_object_class).
|
||||
if oc := int(toInt64(row["object_class"])); oc != 0 {
|
||||
row["object_class_name"] = s.translateObjectClass(oc, toStr(row["name"]))
|
||||
}
|
||||
|
||||
// material_name + material prefix on name (material is already a
|
||||
// translated string in the DB; enrich_db_item:2371-2602).
|
||||
if mat := toStr(row["material"]); mat != "" {
|
||||
|
|
@ -383,6 +389,32 @@ func (s *Server) enrichRows(rows []map[string]any) []map[string]any {
|
|||
return out
|
||||
}
|
||||
|
||||
// translateObjectClass mirrors translate_object_class: ObjectClass enum lookup,
|
||||
// with the context-aware Gem(11) classification by item name. The aetheria-by-
|
||||
// IntValues path (for gem-class items not named crystal/gem/mana stone) is not
|
||||
// reproduced here (it needs original_json) — a documented rare edge.
|
||||
func (s *Server) translateObjectClass(oc int, name string) string {
|
||||
base, ok := s.objectClasses[oc]
|
||||
if !ok {
|
||||
return fmt.Sprintf("Unknown_ObjectClass_%d", oc)
|
||||
}
|
||||
if base == "Gem" && oc == 11 {
|
||||
n := strings.ToLower(name)
|
||||
switch {
|
||||
case strings.Contains(n, "mana stone"):
|
||||
return "Mana Stone"
|
||||
case strings.Contains(n, "crystal"):
|
||||
return "Crystal"
|
||||
case strings.Contains(n, "gem"):
|
||||
return "Gem"
|
||||
case strings.Contains(n, "aetheria"):
|
||||
return "Aetheria"
|
||||
}
|
||||
return "Gem"
|
||||
}
|
||||
return base
|
||||
}
|
||||
|
||||
// translateSetID mirrors translate_equipment_set_id (AttributeSetInfo lookup,
|
||||
// ID-string fallback).
|
||||
func (s *Server) translateSetID(setID string) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue