document

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendConcordancesStats

func AppendConcordancesStats(ctx context.Context, body []byte) ([]byte, error)

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

func AppendEDTFRanges(ctx context.Context, body []byte) ([]byte, error)

AppendEDTFRanges appends numeric date ranges derived from `edtf:inception` and `edtf:cessation` properties to a Who's On First document.

func AppendNameStats

func AppendNameStats(ctx context.Context, body []byte) ([]byte, error)

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

func AppendPlacetypeDetails(ctx context.Context, body []byte) ([]byte, error)

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

func AppendSpelunkerV1Properties(ctx context.Context, body []byte) ([]byte, error)

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

func ExtractProperties(ctx context.Context, body []byte) ([]byte, error)

ExtractProperties returns the "properties" element of a Who's On First document as a JSON-encoded byte array.

func Flatten

func Flatten(ctx context.Context, body []byte) ([]byte, error)

...

func PrepareSpelunkerV1Document

func PrepareSpelunkerV1Document(ctx context.Context, body []byte) ([]byte, error)

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

Types

type PrepareDocumentFunc

type PrepareDocumentFunc func(context.Context, []byte) ([]byte, error)

type PrepareDocumentFunc is a common method signature updating a Who's On First document for indexing in Elasticsearch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL