That didn't seem to work either.  I think there must be something wrong with 
how we're indexing/storing the polygon and/or how we've configured the 
field/querying it.  The docs are so sparse on this (  

Here's the response:

{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"*:*",
      "fl":"latlng,ID",
      "fq":"{!geofilt sfield=latlng pt=33.3786,-94.8985 d=1}",
      "rows":"2",
      "_":"1564065725241"}},
  "response":{"numFound":10,"start":0,"docs":[
      {
        "latlng":["POLYGON((33.7942704 -84.4412613, 33.7100611 -84.4028091, 
33.7802888 -84.3279648, 33.7942704 -84.4412613))"],
        "ID":"284598223"},
      {
        "latlng":["POLYGON((33.7942704 -84.4412613, 33.7100611 -84.4028091, 
33.7802888 -84.3279648, 33.7942704 -84.4412613))"],
        "ID":"284600596"}]
  }}



On 7/25/19, 2:51 AM, "Ere Maijala" <ere.maij...@helsinki.fi> wrote:

    Oops, sorry! Don't know how I missed that.
    
    Have you tested if it makes any difference if you put the sfield
    parameter inside the fq like in the example
    
(https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_8-5F1_spatial-2Dsearch.html-23geofilt-29-3F&d=DwIDaQ&c=hrETxhO8sRCXAcJITi-bu62jJ43QQVS6-BatTNT-3bs&r=3lL1Fjs6t-l8MLo9jYFBo7cXQNBxZBB5BXFvpvXk4cU&m=JR0_KNI-GjB0_I3qC1jsCqb3SySydbHO0e6W5SeYKH4&s=76D0RQHnWeh9KYT1Kx4Q4rz3lMgPR3krYF8uuKVtFaU&e=
 
    We actually put pt and d in there too, e.g.
    
    {!geofilt+sfield%3Dlocation_geo+pt%3D61.2%2C24.9+d%3D1}
    
    --Ere
    
    Sanders, Marshall (CAI - Atlanta) kirjoitti 24.7.2019 klo 16.33:
    > My example query has d=1 as the first parameter, so none of the results 
should be coming back, but they are which makes it seem like it's not doing any 
geofiltering for some reason.
    > 
    > On 7/24/19, 2:06 AM, "Ere Maijala" <ere.maij...@helsinki.fi> wrote:
    > 
    >     I think you might be missing the d parameter in geofilt. I'm not sure 
if
    >     geofilt actually does anything useful without it.
    >     
    >     Regards,
    >     Ere
    >     
    >     Sanders, Marshall (CAI - Atlanta) kirjoitti 23.7.2019 klo 21.32:
    >     > We’re trying to index a polygon into solr and then filter/calculate 
geodist on the polygon (ideally we actually want a circle, but it looks like 
that’s not really supported officially by wkt/geojson and instead you have to 
switch format=”legacy” which seems like something that might be removed in the 
future so don’t want to rely on it).
    >     > 
    >     > Here’s the info from schema:
    >     > <field name="latlng" type="location_rpt" indexed="true" 
stored="true" multiValued="true"/>
    >     > 
    >     > <fieldType name="location_rpt" 
class="solr.SpatialRecursivePrefixTreeFieldType"
    >     >                    geo="true" distErrPct="0.025" 
maxDistErr="0.000009" distanceUnits="kilometers"
    >     >                     spatialContextFactory="Geo3D"/>
    >     > 
    >     > 
    >     > We’ve tried indexing some different data, but to keep it as simple 
as possible we started with a triangle (will eventually add more points to 
approximate a circle).  Here’s an example document that we’ve added just for 
testing:
    >     > 
    >     > {
    >     > "latlng": ["POLYGON((33.7942704 -84.4412613, 33.7100611 
-84.4028091, 33.7802888 -84.3279648, 33.7942704 -84.4412613))"],
    >     > "ID": "284598223"
    >     > }
    >     > 
    >     > 
    >     > However, it seems like filtering/distance calculations aren’t 
working (at least not the way we are used to doing it for points).  Here’s an 
example query where the pt is several hundred kilometers away from the polygon, 
yet the document still returns.  Also, it seems that regardless of origin point 
or polygon location the calculated geodist is always 20015.115
    >     > 
    >     > Example query:
    >     > 
select?d=1&fl=ID,latlng,geodist()&fq=%7B!geofilt%7D&indent=on&pt=33.9798087,-94.3286133&q=*:*&sfield=latlng&wt=json
    >     > 
    >     > Example documents coming back anyway:
    >     > "docs": [
    >     > {
    >     > "latlng": ["POLYGON((33.7942704 -84.4412613, 33.7100611 
-84.4028091, 33.7802888 -84.3279648, 33.7942704 -84.4412613))"],
    >     > "ID": "284598223",
    >     > "geodist()": 20015.115
    >     > },
    >     > {
    >     > "latlng": ["POLYGON((33.7942704 -84.4412613, 33.7100611 
-84.4028091, 33.7802888 -84.3279648, 33.7942704 -84.4412613))"],
    >     > "ID": "284600596",
    >     > "geodist()": 20015.115
    >     > }
    >     > ]
    >     > 
    >     > 
    >     > Anyone who has experience in this area can you point us in the 
right direction about what we’re doing incorrectly with either how we are 
indexing the data and/or how we are querying against the polygons.
    >     > 
    >     > Thank you,
    >     > 
    >     > 
    >     > --
    >     > Marshall Sanders
    >     > Principal Software Engineer
    >     > Autotrader.com
    >     > 
marshall.sande...@coxautoinc.com<mailto:marshall.sande...@coxautoinc.com>
    >     > 
    >     > 
    >     
    >     -- 
    >     Ere Maijala
    >     Kansalliskirjasto / The National Library of Finland
    >     
    > 
    
    -- 
    Ere Maijala
    Kansalliskirjasto / The National Library of Finland
    

Reply via email to