Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-9407

Change the visibility of LatLonXQuery classes to public

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 8.5.2
    • Fix Version/s: None
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Problem description

       
      A few years ago the geospatial queries  classes have been refactored to be package-private:
       

      final class LatLonPointInPolygonQuery extends Query
      

       
      I get that there must be a reason for making use of package-private constructors in the geospatial query classes, but I'm wondering whether it would hurt to leave the classes still public.
       
      Having the classes package-private means that they can't be used outside of the 
       
       
      package org.apache.lucene.document;
       
      This is the PR in which the refactoring was made:
      https://github.com/apache/lucene-solr/commit/2264600ffe4649abb0edbe7a6882ffc82f6e918b
       
       
       

      Background

      Elasticsearch Percolator dealing with geospatial queries 

      In the elasticsearch code (specifically over the percolator functionality) I have noticed that when using polygon queries at the moment there isn't possible to do a reversed search on the search queries index.
       
      This means that for all the geospatial queries are applied against the elasticsearch memory index in order to check for a percolation match.
       
      If the percolator deals with 
       
      org.apache.lucene.document.LatLonPointInPolygonQuery
       
      then it should probably suffice making use of  the 
       
      org.apache.lucene.document.LatLonShapeBoundingBoxQuery
       
      for finding the search queries that have polygons containing the LatLonPoint of the location field of the document being percolated.

      Proposed solution

       
      Increase the visibility of the LatLonXQuery classes to public so that they can 
      be used in other packages (e.g. elasticsearch percolator code).

       

      NOTE that the constructors of the classes are still package-protected reason why the classes won't be able to be instantiated outside of their original package.

       
      In the elasticsearch percolator code I'd have to make use explicitly of the LatLonPointInPolygonQuery class (instanceof) when analyzing the search queries to be used in the percolation process:
       
      https://github.com/elastic/elasticsearch/blob/master/modules/percolator/src/main/java/org/elasticsearch/percolator/QueryAnalyzer.java#L186
       

      Pull request

       

      https://github.com/apache/lucene-solr/pull/1583

       
       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mariusneo Marius Grama
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m