[ 
https://issues.apache.org/jira/browse/SOLR-18016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18044421#comment-18044421
 ] 

ASF subversion and git services commented on SOLR-18016:
--------------------------------------------------------

Commit 7e4af6667e40d4c1d40e08f649dee57d99f76d54 in solr's branch 
refs/heads/branch_10x from David Smiley
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=7e4af6667e4 ]

SOLR-18016: Fix spatial distance sorting with SRPT and filter cache (#3935)

SolrIndexSearcher: shouldn't avoid calling LeafCollector.setScorer

Move test

> NPE when distance sorting on SpatialRecursivePrefixTreeFieldType
> ----------------------------------------------------------------
>
>                 Key: SOLR-18016
>                 URL: https://issues.apache.org/jira/browse/SOLR-18016
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 9.9, 9.10
>            Reporter: Umut Saribiyik
>            Assignee: David Smiley
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2025-12-05-16-20-48-202.png
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> *Summary*
> Sorting exception for {{SpatialRecursivePrefixTreeFieldType}} when using 
> spatialContextFactory="JTS". Identical to SOLR-18006 but for a different 
> field type.
> *Description*
> Hello [~janhoy] [~dsmiley] 
> an issue identical to *SOLR-18006* occurs when using the field type 
> *{{SpatialRecursivePrefixTreeFieldType}}* with 
> {{{}*spatialContextFactory="JTS"*{}}}.
> Both sorting directions ({{{}asc{}}} and {{{}desc{}}}) result in the same 
> exception, which worked before solr 9.9 and 9.10
> I was able to reproduce this on {*}main{*}, by extending the existing 
> {{TestSolr4Spatial2}} class with an additional test.
> ----
> h2. *Steps to Reproduce*
> h3. *1. Add JTS dependency*
> Extend {{{}build.gradle{}}}:
> {code:java}
> implementation("org.locationtech.jts:jts-core:1.20.0") {code}
> *2. Disable dependency locking (for local testing only)*
> In {{{}dependencies.gradle{}}}, comment out:
> {code:java}
> // lockAllConfigurations(){code}
> (This is required only locally to avoid blocking the JTS dependency.
> h3. *3. Extend schema with additional field type and field*
> Add to {{{}schema-spatial.xml{}}}:
> {code:java}
> ...
> <fieldType name="location_jts" 
> class="solr.SpatialRecursivePrefixTreeFieldType" geo="true" 
> maxDistErr="0.001" spatialContextFactory="JTS" distErrPct="0.025" 
> distanceUnits="kilometers"/>
> ...
> <field name="location_jts" type="location_jts" uninvertible="true" 
> multiValued="false" indexed="true" stored="true"/>{code}
> h3. *4. Add and run the test*
>  
> {code:java}
> @Test
> public void 
> test_geodist_on_SpatialRecursivePrefixTreeFieldType_with_jts_spatialContextFactory()
>  throws Exception {
>   String fieldName = "location_jts";
>   // Index sample documents
>   assertU(adoc("id", "jts-001", fieldName, "11.628476,48.106651"));
>   assertU(adoc("id", "jts-002", fieldName, "11.622016,48.113089"));
>   assertU(adoc("id", "jts-003", fieldName, "11.576124,48.137154"));
>   assertU(adoc("id", "jts-004", fieldName, "11.581981,48.135125"));
>   assertU(adoc("id", "jts-005", fieldName, "11.612,48.121"));
>   assertU(adoc("id", "jts-006", fieldName, "11.64,48.09"));
>   assertU(commit());
>   assertJQ(
>       req(
>           "q", "*:*",
>           "fq", "{!geofilt}",
>           "sfield", fieldName,
>           "pt", "11.622015740056845,48.11308880280511",
>           "d", "1000",
>           "fl", "id",
>           "sort", "geodist() desc"), // Or 'geodist() asc'
>       "/response/numFound==6",
>       "/response/docs/[0]/id=='jts-003'", // farthest
>       "/response/docs/[1]/id=='jts-004'",
>       "/response/docs/[2]/id=='jts-006'",
>       "/response/docs/[3]/id=='jts-005'",
>       "/response/docs/[4]/id=='jts-001'",
>       "/response/docs/[5]/id=='jts-002'"); // closest
> }{code}
>  
> *Test Result:*
> !image-2025-12-05-16-20-48-202.png!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to