0
0
Fork 0

doc: document field values storage and retrieval

This commit is contained in:
Patrick Mezard 2015-10-04 11:25:58 +02:00
parent e3a185b1c5
commit ee8af9cfa3
3 changed files with 14 additions and 7 deletions

View File

@ -28,6 +28,8 @@ type FieldMapping struct {
// the IndexMapping.DefaultAnalyzer.
Analyzer string `json:"analyzer,omitempty"`
// Store indicates whether to store field values in the index. Stored
// values can be retrieved from search results using SearchRequest.Fields.
Store bool `json:"store,omitempty"`
Index bool `json:"index,omitempty"`
IncludeTermVectors bool `json:"include_term_vectors,omitempty"`

View File

@ -152,7 +152,8 @@ func (h *HighlightRequest) AddField(field string) {
// Highlight describes optional search result
// highlighting.
// Fields describes a list of field values which
// should be retrieved for result documents.
// should be retrieved for result documents, provided they
// were stored while indexing.
// Facets describe the set of facets to be computed.
// Explain triggers inclusion of additional search
// result score explanations.

View File

@ -37,12 +37,16 @@ type FieldTermLocationMap map[string]TermLocationMap
type FieldFragmentMap map[string][]string
type DocumentMatch struct {
ID string `json:"id"`
Score float64 `json:"score"`
Expl *Explanation `json:"explanation,omitempty"`
Locations FieldTermLocationMap `json:"locations,omitempty"`
Fragments FieldFragmentMap `json:"fragments,omitempty"`
Fields map[string]interface{} `json:"fields,omitempty"`
ID string `json:"id"`
Score float64 `json:"score"`
Expl *Explanation `json:"explanation,omitempty"`
Locations FieldTermLocationMap `json:"locations,omitempty"`
Fragments FieldFragmentMap `json:"fragments,omitempty"`
// Fields contains the values for document fields listed in
// SearchRequest.Fields. Text fields are returned as strings, numeric
// fields as float64s and date fields as time.RFC3339 formatted strings.
Fields map[string]interface{} `json:"fields,omitempty"`
}
func (dm *DocumentMatch) AddFieldValue(name string, value interface{}) {