@@ -109,19 +109,19 @@ func main() {
109
109
}
110
110
111
111
// Add fields to document
112
- err = doc .AddField (NameTitle , "Example Title" , index )
112
+ err = doc .AddField ("Example Title" , index , NameTitle )
113
113
if err != nil {
114
114
fmt .Println ("Failed to add field to document:" , err )
115
115
return
116
116
}
117
117
118
- err = doc .AddField (NameId , "1" , index )
118
+ err = doc .AddField ("1" , index , NameId )
119
119
if err != nil {
120
120
fmt .Println ("Failed to add field to document:" , err )
121
121
return
122
122
}
123
123
124
- err = doc .AddField (NameBody , "Example body content." , index )
124
+ err = doc .AddField ("Example body content." , index , NameBody )
125
125
if err != nil {
126
126
fmt .Println ("Failed to add field to document:" , err )
127
127
return
@@ -160,7 +160,7 @@ func main() {
160
160
break
161
161
}
162
162
// Get JSON representation of the document
163
- jsonStr , err := doc .ToJson (schema , NameId , NameTitle , NameBody )
163
+ jsonStr , err := doc .ToJson (index , NameId , NameTitle , NameBody )
164
164
if err != nil {
165
165
fmt .Println ("Failed to get document JSON:" , err )
166
166
} else {
0 commit comments