opensearch

package module
v0.0.0-...-54b43df Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: BSD-3-Clause Imports: 28 Imported by: 0

README

go-whosonfirst-spelunker-opensearch

Go package implementing the whosonfirst/go-whosonfirst-spelunker.Spelunker interface for use with OpenSearch databases.

Documentation

Documentation is incompete at this time. For starters consult the (also incomplete) documentation in the whosonfirst/go-whosonfirst-spelunker package.

Important

This is work in progress and you should expect things to change, break or simply not work yet.

Examples

Note: All the examples assume a "local" setup meaning there is local instance of OpenSearch running on port 9200.

Indexing

Using the wof-opensearch-index tool from the whosonfirst/go-whosonfirst-opensearch package:

$> bin/wof-opensearch-index \
	-writer-uri 'constant://?val=opensearch2%3A%2F%2Flocalhost%3A9200%2Fspelunker%3Fusername%3Dadmin%26password%3...%26insecure%3Dtrue%26require-tls%3Dtrue' \
	/usr/local/data/whosonfirst-data-admin-ca/

Note the unfortunate need to URL escape the -writer-uri=constant://?val= parameter which unescaped is the actual go-whosonfirst-opensearch/writer.OpensearchV2Writer URI that takes the form of:

opensearch2://localhost:9200/spelunker?require-tls=true&insecure=true&debug=false&username=admin&password=s33kret

The wof-opensearch-index application however expects a gocloud.dev/runtimevar URI so that you don't need to deply production configuration values with sensitive values (like OpenSearch admin passwords) exposed in them. Under the hood the wof-opensearch-index application is using the sfomuseum/runtimevar package to manage the details and this needs to be updated to allow plain (non-runtimevar) strings. Or maybe the wof-opensearch-index application needs to be updated. Either way something needs to be updated to avoid the hassle of always needing to URL-escape things.

Tools

server
$> make server
go run -mod vendor cmd/httpd/main.go \
		-server-uri http://localhost:8080 \
		-spelunker-uri 'opensearch://?dsn=https%3A%2F%2Flocalhost%3A9200%2Fspelunker%3Fusername%3Dadmin%26password%3Ddkjfhsjdkfkjdjhksfhskd98475kjHkzjxckj%26insecure%3Dtrue%26require-tls%3Dtrue'
2024/03/11 09:06:51 INFO Listening for requests address=http://localhost:8080

See all the URL escaped gibberish in the -spelunker-uri flag? It's the same issues described in the docs for the wof-opensearch-index tool above.

See also

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCursorIsExpired = errors.New("Query cursor has expired")

Functions

func NewOpenSearchSpelunker

func NewOpenSearchSpelunker(ctx context.Context, uri string) (spelunker.Spelunker, error)

func NewSpelunkerRecordSPR

func NewSpelunkerRecordSPR(props []byte) (wof_spr.StandardPlacesResult, error)

func NewSpelunkerStandardPlacesResults

func NewSpelunkerStandardPlacesResults(results []wof_spr.StandardPlacesResult) wof_spr.StandardPlacesResults

Types

type OpenSearchSpelunker

type OpenSearchSpelunker struct {
	spelunker.Spelunker
	// contains filtered or unexported fields
}

func (*OpenSearchSpelunker) CountDescendants

func (s *OpenSearchSpelunker) CountDescendants(ctx context.Context, id int64) (int64, error)

func (*OpenSearchSpelunker) GetConcordances

func (s *OpenSearchSpelunker) GetConcordances(ctx context.Context) (*spelunker.Faceting, error)

func (*OpenSearchSpelunker) GetDescendants

func (s *OpenSearchSpelunker) GetDescendants(ctx context.Context, pg_opts pagination.Options, id int64, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) GetDescendantsFaceted

func (s *OpenSearchSpelunker) GetDescendantsFaceted(ctx context.Context, id int64, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

func (*OpenSearchSpelunker) GetFeatureForId

func (s *OpenSearchSpelunker) GetFeatureForId(ctx context.Context, id int64, uri_args *uri.URIArgs) ([]byte, error)

func (*OpenSearchSpelunker) GetPlacetypes

func (s *OpenSearchSpelunker) GetPlacetypes(ctx context.Context) (*spelunker.Faceting, error)

func (*OpenSearchSpelunker) GetRecent

func (s *OpenSearchSpelunker) GetRecent(ctx context.Context, pg_opts pagination.Options, d time.Duration, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) GetRecentFaceted

func (s *OpenSearchSpelunker) GetRecentFaceted(ctx context.Context, d time.Duration, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

func (*OpenSearchSpelunker) GetRecordForId

func (s *OpenSearchSpelunker) GetRecordForId(ctx context.Context, id int64) ([]byte, error)

func (*OpenSearchSpelunker) GetTags

func (s *OpenSearchSpelunker) GetTags(ctx context.Context) (*spelunker.Faceting, error)

func (*OpenSearchSpelunker) HasConcordance

func (s *OpenSearchSpelunker) HasConcordance(ctx context.Context, pg_opts pagination.Options, namespace string, predicate string, value any, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) HasConcordanceFaceted

func (s *OpenSearchSpelunker) HasConcordanceFaceted(ctx context.Context, namespace string, predicate string, value any, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

func (*OpenSearchSpelunker) HasPlacetype

func (s *OpenSearchSpelunker) HasPlacetype(ctx context.Context, pg_opts pagination.Options, pt *placetypes.WOFPlacetype, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) HasPlacetypeFaceted

func (s *OpenSearchSpelunker) HasPlacetypeFaceted(ctx context.Context, pt *placetypes.WOFPlacetype, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

func (*OpenSearchSpelunker) HasTag

func (s *OpenSearchSpelunker) HasTag(ctx context.Context, pg_opts pagination.Options, tag string, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) HasTagFaceted

func (s *OpenSearchSpelunker) HasTagFaceted(ctx context.Context, tag string, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

func (*OpenSearchSpelunker) Search

func (s *OpenSearchSpelunker) Search(ctx context.Context, pg_opts pagination.Options, search_opts *spelunker.SearchOptions, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) SearchFaceted

func (s *OpenSearchSpelunker) SearchFaceted(ctx context.Context, search_opts *spelunker.SearchOptions, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

func (*OpenSearchSpelunker) VisitingNullIsland

func (s *OpenSearchSpelunker) VisitingNullIsland(ctx context.Context, pg_opts pagination.Options, filters []spelunker.Filter) (wof_spr.StandardPlacesResults, pagination.Results, error)

func (*OpenSearchSpelunker) VisitingNullIslandFaceted

func (s *OpenSearchSpelunker) VisitingNullIslandFaceted(ctx context.Context, filters []spelunker.Filter, facets []*spelunker.Facet) ([]*spelunker.Faceting, error)

type SpelunkerRecordSPR

type SpelunkerRecordSPR struct {
	wof_spr.StandardPlacesResult
	// contains filtered or unexported fields
}

func (*SpelunkerRecordSPR) BelongsTo

func (s *SpelunkerRecordSPR) BelongsTo() []int64

func (*SpelunkerRecordSPR) Cessation

func (s *SpelunkerRecordSPR) Cessation() *edtf.EDTFDate

func (*SpelunkerRecordSPR) Country

func (s *SpelunkerRecordSPR) Country() string

func (*SpelunkerRecordSPR) Id

func (s *SpelunkerRecordSPR) Id() string

func (*SpelunkerRecordSPR) Inception

func (s *SpelunkerRecordSPR) Inception() *edtf.EDTFDate

func (*SpelunkerRecordSPR) IsCeased

func (s *SpelunkerRecordSPR) IsCeased() flags.ExistentialFlag

func (*SpelunkerRecordSPR) IsCurrent

func (s *SpelunkerRecordSPR) IsCurrent() flags.ExistentialFlag

func (*SpelunkerRecordSPR) IsDeprecated

func (s *SpelunkerRecordSPR) IsDeprecated() flags.ExistentialFlag

func (*SpelunkerRecordSPR) IsSuperseded

func (s *SpelunkerRecordSPR) IsSuperseded() flags.ExistentialFlag

func (*SpelunkerRecordSPR) IsSuperseding

func (s *SpelunkerRecordSPR) IsSuperseding() flags.ExistentialFlag

func (*SpelunkerRecordSPR) LastModified

func (s *SpelunkerRecordSPR) LastModified() int64

func (*SpelunkerRecordSPR) Latitude

func (s *SpelunkerRecordSPR) Latitude() float64

func (*SpelunkerRecordSPR) Longitude

func (s *SpelunkerRecordSPR) Longitude() float64

func (*SpelunkerRecordSPR) MaxLatitude

func (s *SpelunkerRecordSPR) MaxLatitude() float64

func (*SpelunkerRecordSPR) MaxLongitude

func (s *SpelunkerRecordSPR) MaxLongitude() float64

func (*SpelunkerRecordSPR) MinLatitude

func (s *SpelunkerRecordSPR) MinLatitude() float64

func (*SpelunkerRecordSPR) MinLongitude

func (s *SpelunkerRecordSPR) MinLongitude() float64

func (*SpelunkerRecordSPR) Name

func (s *SpelunkerRecordSPR) Name() string

func (*SpelunkerRecordSPR) ParentId

func (s *SpelunkerRecordSPR) ParentId() string

func (*SpelunkerRecordSPR) Path

func (s *SpelunkerRecordSPR) Path() string

func (*SpelunkerRecordSPR) Placetype

func (s *SpelunkerRecordSPR) Placetype() string

func (*SpelunkerRecordSPR) Repo

func (s *SpelunkerRecordSPR) Repo() string

func (*SpelunkerRecordSPR) SupersededBy

func (s *SpelunkerRecordSPR) SupersededBy() []int64

func (*SpelunkerRecordSPR) Supersedes

func (s *SpelunkerRecordSPR) Supersedes() []int64

func (*SpelunkerRecordSPR) URI

func (s *SpelunkerRecordSPR) URI() string

type SpelunkerStandardPlacesResults

type SpelunkerStandardPlacesResults struct {
	wof_spr.StandardPlacesResults
	// contains filtered or unexported fields
}

func (*SpelunkerStandardPlacesResults) Results

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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