MCPcopy Index your code
hub / github.com/blevesearch/bleve / BenchmarkQueryGeoBoundingBox

Function BenchmarkQueryGeoBoundingBox

query_bench_test.go:313–393  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

311}
312
313func BenchmarkQueryGeoBoundingBox(b *testing.B) {
314 tmpIndexPath := createTmpIndexPath(b)
315 defer cleanupTmpIndexPath(b, tmpIndexPath)
316
317 fm := mapping.NewGeoPointFieldMapping()
318 dmap := mapping.NewDocumentMapping()
319 dmap.AddFieldMappingsAt("geo", fm)
320 imap := mapping.NewIndexMapping()
321 imap.DefaultMapping = dmap
322
323 idx, err := New(tmpIndexPath, imap)
324 if err != nil {
325 b.Fatal(err)
326 }
327
328 defer func() {
329 err = idx.Close()
330 if err != nil {
331 b.Fatal(err)
332 }
333 }()
334
335 members := [][]float64{
336 {-121.96713072883645, 37.380331474621045},
337 {-97.75518866579938, 30.38974491308761},
338 {-0.08653451918110022, 51.51063984942306},
339 {-2.230759791360498, 53.481514330841236},
340 {77.59542326042589, 12.97215865921956},
341 }
342 for i := 0; i < 100; i++ {
343 if err = idx.Index(strconv.Itoa(i),
344 map[string]interface{}{"geo": members[i%len(members)]}); err != nil {
345 b.Fatal(err)
346 }
347 }
348
349 boundingBoxes := []struct {
350 topLeft []float64
351 bottomRight []float64
352 }{
353 {
354 topLeft: []float64{-122.14424992609722, 37.49751487670511},
355 bottomRight: []float64{-121.78076546622579, 37.26963069737202},
356 },
357 {
358 topLeft: []float64{-97.85362236226437, 30.473743975245725},
359 bottomRight: []float64{-97.58691085968482, 30.285211697102895},
360 },
361 {
362 topLeft: []float64{-0.28538822102223094, 51.61106497119687},
363 bottomRight: []float64{0.16776748108466677, 51.395702237541286},
364 },
365 {
366 topLeft: []float64{-2.373683904907921, 53.54371945714075},
367 bottomRight: []float64{-2.134365533113197, 53.41788831720595},
368 },
369 {
370 topLeft: []float64{77.52617635172015, 13.037587208986437},

Callers

nothing calls this directly

Calls 13

AddFieldMappingsAtMethod · 0.95
SetFieldMethod · 0.95
NewGeoPointFieldMappingFunction · 0.92
NewDocumentMappingFunction · 0.92
NewIndexMappingFunction · 0.92
createTmpIndexPathFunction · 0.85
cleanupTmpIndexPathFunction · 0.85
NewSearchRequestFunction · 0.85
NewFunction · 0.70
NewGeoBoundingBoxQueryFunction · 0.70
CloseMethod · 0.65
IndexMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…