Skip to content

Compilation error in geo/geojson package: does not implement index.GeoJSON (missing method BoundingBox) #2390

Description

@cod3rboy

Environment

OS: Zorin OS 18.1
Go: 1.26.3
Belve: v2.6.0

Description

# github.com/blevesearch/geo/geojson
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:100:9: cannot use rv (variable of type *Point) as index.GeoJSON value in return statement: *Point does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:129:46: cannot use p (variable of type *Point) as index.GeoJSON value in argument to checkPointIntersectsShape: *Point does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:155:9: cannot use rv (variable of type *MultiPoint) as index.GeoJSON value in return statement: *MultiPoint does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:206:49: cannot use p (variable of type *MultiPoint) as index.GeoJSON value in argument to checkPointIntersectsShape: *MultiPoint does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:241:17: cannot use &Point{…} (value of type *Point) as index.GeoJSON value in assignment: *Point does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:258:9: cannot use rv (variable of type *LineString) as index.GeoJSON value in return statement: *LineString does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:297:64: cannot use ls (variable of type *LineString) as index.GeoJSON value in argument to checkLineStringsIntersectsShape: *LineString does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:322:9: cannot use rv (variable of type *MultiLineString) as index.GeoJSON value in return statement: *MultiLineString does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:366:48: cannot use p (variable of type *MultiLineString) as index.GeoJSON value in argument to checkLineStringsIntersectsShape: *MultiLineString does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:389:16: cannot use &LineString{…} (value of type *LineString) as index.GeoJSON value in assignment: *LineString does not implement index.GeoJSON (missing method BoundingBox)
../../go/pkg/mod/github.com/blevesearch/geo@v0.2.5/geojson/geojson_shapes_impl.go:389:16: too many errors

Replication Steps

  1. Initialize new go module
  2. Run go get github.com/blevesearch/bleve/v2@v2.6.0
  3. Create the main.go file with the code below:
package main

import (
	"log"

	"github.com/blevesearch/bleve/v2"
	"github.com/blevesearch/bleve/v2/mapping"
)

type Document struct {
	Name        string `json:"name"`
	Description string `json:"desc"`
}

func main() {
	// Define mapping
	idxMapping := mapping.NewIndexMapping()
	nameFieldMapping := mapping.NewTextFieldMapping()
	descFieldMapping := mapping.NewTextFieldMapping()
	idxMapping.DefaultMapping = mapping.NewDocumentMapping()
	idxMapping.DefaultMapping.AddFieldMappingsAt("name", nameFieldMapping)
	idxMapping.DefaultMapping.AddFieldMappingsAt("desc", descFieldMapping)

	// Create new index
	idx, err := bleve.New("test.belve", idxMapping)
	if err != nil {
		log.Fatal(err)
	}

	// Create a document
	doc := Document{
		Name:        "Document A",
		Description: "This is the description for document A",
	}

	// Index the document
	if err := idx.Index("document-1", doc); err != nil {
		log.Fatal(err)
	}

	// Success
	log.Println("Successfully indexed document!")
}
  1. Build or run the main.go file.
go build main.go

or

go run main.go

Expected Behavior

The main.go file should compile or run without any errors.

Actual Behavior

Compilation fails and errors are encountered (shared above in error logs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions