Documentation ¶
Overview ¶
package document provides methods for updating a single Who's On First document for indexing in Elasticsearch.
Note: One of the things you'll see in the code that makes up the `document` package is stuff like this:
for k, v := range to_assign { path := k if props_rsp.Exists() { path = fmt.Sprintf("properties.%s", k) } body, err = sjson.SetBytes(body, path, v) ... }
This is code to account for the fact that a record may be a "spelunker v1" document in which case it will be a simple hash map, equivalent to a GeoJSON properties dictionary, rather than a complete GeoJSON document.
Index ¶
- func AppendConcordancesStats(ctx context.Context, body []byte) ([]byte, error)
- func AppendEDTFRanges(ctx context.Context, body []byte) ([]byte, error)
- func AppendNameStats(ctx context.Context, body []byte) ([]byte, error)
- func AppendPlacetypeDetails(ctx context.Context, body []byte) ([]byte, error)
- func AppendSpelunkerV1Properties(ctx context.Context, body []byte) ([]byte, error)
- func ExtractProperties(ctx context.Context, body []byte) ([]byte, error)
- func Flatten(ctx context.Context, body []byte) ([]byte, error)
- func PrepareSpelunkerV1Document(ctx context.Context, body []byte) ([]byte, error)
- type PrepareDocumentFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendConcordancesStats ¶
AppendConcordancesStats appends statistics about the `wof:concordances` properties in a Who's On First document. Specifically: * An array containing the set of source prefixes for concordances * The total number of concordances in a record.
func AppendEDTFRanges ¶
AppendEDTFRanges appends numeric date ranges derived from `edtf:inception` and `edtf:cessation` properties to a Who's On First document.
func AppendNameStats ¶
AppendNameStats appends statistics about the `name:*` properties in a Who's On First record. Specifically: * The unique set of language translations * The total number of names * The total number of languages * The total number of "prefered" names * The total number of "variant" names
func AppendPlacetypeDetails ¶
AppendPlacetypeDetails appends addition properties related to the `wof:placetype` and `wof:placetype_alt` properties in a Who's On First record. Specifically: * The unique placetype ID for a placetype * The set of string names (including "alternate" placetypes) associated with a placetype
func AppendSpelunkerV1Properties ¶
AppendSpelunkerV1Properties appends properties specific to the v1" Elasticsearch (v2.x) schema to a Who's On First document for. For details please consult: https://github.com/whosonfirst/es-whosonfirst-schema/tree/master/schema/2.4
func ExtractProperties ¶
ExtractProperties returns the "properties" element of a Who's On First document as a JSON-encoded byte array.
func PrepareSpelunkerV1Document ¶
PrepareSpelunkerV1Document prepares a Who's On First document for indexing with the "v1" Elasticsearch (v2.x) schema. For details please consult: https://github.com/whosonfirst/es-whosonfirst-schema/tree/master/schema/2.4