mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
Search Index Build
This commit is contained in:
@@ -7,6 +7,10 @@ import (
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/providers/xmlprovider"
|
||||
)
|
||||
|
||||
const (
|
||||
WORKS_CATEGORY = "work"
|
||||
)
|
||||
|
||||
type Work struct {
|
||||
XMLName xml.Name `xml:"werk"`
|
||||
URLs []URL `xml:"url"`
|
||||
@@ -49,3 +53,30 @@ func (w Work) String() string {
|
||||
data, _ := json.MarshalIndent(w, "", " ")
|
||||
return string(data)
|
||||
}
|
||||
|
||||
func (w Work) Readable(lib *Library) map[string]interface{} {
|
||||
ret := map[string]interface{}{
|
||||
"ID": w.ID,
|
||||
"PreferredTitle": w.PreferredTitle,
|
||||
"Title": w.Citation.Title,
|
||||
"Year": w.Citation.Year,
|
||||
"CitationTitle": w.Citation.Title,
|
||||
}
|
||||
|
||||
for k, v := range w.AnnotationNote.Readable() {
|
||||
ret[k] = v
|
||||
}
|
||||
|
||||
agents := make([]map[string]interface{}, len(w.AgentRefs))
|
||||
for k, v := range w.AgentRefs {
|
||||
agents[k] = v.Readable(lib)
|
||||
}
|
||||
|
||||
ret["Agents"] = agents
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (w Work) Type() string {
|
||||
return WORKS_CATEGORY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user