This is an automated email from the ASF dual-hosted git repository.

rkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git


The following commit(s) were added to refs/heads/master by this push:
     new 4eddb32  SDAP-39 - Querying tiles by polygon now uses bbox query where 
possible (#279)
4eddb32 is described below

commit 4eddb3257168b1861faa16f604f362eaebe9109e
Author: Riley Kuttruff <[email protected]>
AuthorDate: Mon Sep 18 10:09:09 2023 -0700

    SDAP-39 - Querying tiles by polygon now uses bbox query where possible 
(#279)
    
    * Polygon searches fall to bbox searches w/ poly bounds
    
    * Changelog
    
    * Moved poly -> bbox to SolrProxy methods
    
    * Revert "Polygon searches fall to bbox searches w/ poly bounds"
    
    This reverts commit 7f0f3f990e09987a8a1390af9e5a532adfee26c8.
    
    * Consistency of how poly to bbox is done
    
    * Cleanup
    
    ---------
    
    Co-authored-by: rileykk <[email protected]>
---
 CHANGELOG.md                            |  1 +
 data-access/nexustiles/dao/SolrProxy.py | 20 +++++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2701e0..1178918 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,7 @@ and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0
 - SDAP-474: Fixed bug in CSV attributes where secondary dataset would be 
rendered as comma separated characters
 - SDAP-475: Bug fixes for `/timeSeriesSpark` and `/timeAvgMapSpark`
 - SDAP-479: Fixed `/cdmssubset` failure for variables without specified 
standard_name. 
+- SDAP-39: When querying for tiles by polygon, use the poly's bounding box 
with the bbox methods instead of using Solr's polygon search
 - Status code for results endpoint if execution id is not found fixed to be 
`404` instead of `500`.
 ### Security
 
diff --git a/data-access/nexustiles/dao/SolrProxy.py 
b/data-access/nexustiles/dao/SolrProxy.py
index 9b16533..ca1033a 100644
--- a/data-access/nexustiles/dao/SolrProxy.py
+++ b/data-access/nexustiles/dao/SolrProxy.py
@@ -230,9 +230,11 @@ class SolrProxy(object):
 
         search = 'dataset_s:%s' % ds
 
+        min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
+
         params = {
             'fq': [
-                "{!field f=geo}Intersects(%s)" % bounding_polygon.wkt,
+                "geo:[%s,%s TO %s,%s]" % (min_lat, min_lon, max_lat, max_lon),
                 "tile_count_i:[1 TO *]",
                 "day_of_year_i:[* TO %s]" % day_of_year
             ],
@@ -312,9 +314,11 @@ class SolrProxy(object):
 
         search = 'dataset_s:%s' % ds
 
+        min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
+
         additionalparams = {
             'fq': [
-                "{!field f=geo}Intersects(%s)" % bounding_polygon.wkt,
+                "geo:[%s,%s TO %s,%s]" % (min_lat, min_lon, max_lat, max_lon),
                 "tile_count_i:[1 TO *]"
             ]
         }
@@ -344,9 +348,11 @@ class SolrProxy(object):
 
         search = 'dataset_s:%s' % ds
 
+        min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
+
         additionalparams = {
             'fq': [
-                "{!field f=geo}Intersects(%s)" % bounding_polygon.wkt,
+                "geo:[%s,%s TO %s,%s]" % (min_lat, min_lon, max_lat, max_lon),
                 "tile_count_i:[1 TO *]"
             ]
         }
@@ -376,9 +382,11 @@ class SolrProxy(object):
 
         search = 'dataset_s:%s' % ds
 
+        min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
+
         additionalparams = {
             'fq': [
-                "{!field f=geo}Intersects(%s)" % bounding_polygon.wkt,
+                "geo:[%s,%s TO %s,%s]" % (min_lat, min_lon, max_lat, max_lon),
                 "tile_count_i:[1 TO *]"
             ],
             'rows': 0,
@@ -480,9 +488,11 @@ class SolrProxy(object):
                           the_time, the_time
                       )
 
+        min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
+
         additionalparams = {
             'fq': [
-                "{!field f=geo}Intersects(%s)" % bounding_polygon.wkt,
+                "geo:[%s,%s TO %s,%s]" % (min_lat, min_lon, max_lat, max_lon),
                 "tile_count_i:[1 TO *]",
                 time_clause
             ]

Reply via email to