SOlr Spatial Search - Filter and sort on multiple cities

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SOlr Spatial Search - Filter and sort on multiple cities

anushka gupta
Hi,

I want to be able to filter on different cities and also sort the results
based on geoproximity. But sorting doesn’t work:

admin_directory_search_geolocation?q=david&fq=({!geofilt+sfield=adminLatLon+pt=33.0198431,-96.6988856+d=80+sort=min(geodist(33.0198431,-96.6988856))})+OR+({!geofilt+sfield=adminLatLon+pt=50.2171726,8.265894+d=80+sort=min(geodist(50.2171726,8.265894))})

Sorting works fine if I add ‘&’ in geofilt condition like :
q=david&fq={!geofilt&sfield=adminLatLon&pt=33.0198431,-96.6988856&d=80&sort=geodist(33.0198431,-96.6988856)}

But when I combine the two FQs then sorting doesn’t work.

Please help.




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: SOlr Spatial Search - Filter and sort on multiple cities

Erick Erickson
Well, first of all your first query with the two fq clauses has sort specified with a space, rather than an ampersand (&). Twice. Even if that worked, Solr would only use one I think.

It’s really unclear what you’re after. It makes no sense to me to specify two sorts in a single query, which is what you’re trying to do. You say “Sort the results by geoproximity”. Geoproximity to _what_? The firs city? The second? Both? Would it make any sense to your users to have a list sorted like

doc 10: 1.0 km from point a
doc 34: 1.1 km from point b
doc 17: 1.2 km from point b
doc 80: 1.3 km from point a

That seems horribly confusing. But if that’s what you want, try something like a single sort clause (not two) like:
&sort=min(geodist(sfield, lat1, lon1),geodist(sfield,lat2,lon2))

> On Sep 30, 2019, at 10:53 AM, anushka gupta <[hidden email]> wrote:
>
> Hi,
>
> I want to be able to filter on different cities and also sort the results
> based on geoproximity. But sorting doesn’t work:
>
> admin_directory_search_geolocation?q=david&fq=({!geofilt+sfield=adminLatLon+pt=33.0198431,-96.6988856+d=80+sort=min(geodist(33.0198431,-96.6988856))})+OR+({!geofilt+sfield=adminLatLon+pt=50.2171726,8.265894+d=80+sort=min(geodist(50.2171726,8.265894))})
>
> Sorting works fine if I add ‘&’ in geofilt condition like :
> q=david&fq={!geofilt&sfield=adminLatLon&pt=33.0198431,-96.6988856&d=80&sort=geodist(33.0198431,-96.6988856)}
>
> But when I combine the two FQs then sorting doesn’t work.
>
> Please help.
>
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply | Threaded
Open this post in threaded view
|

Re: SOlr Spatial Search - Filter and sort on multiple cities

anushka gupta
Thanks,

Could you please also let me know how to combine two geofilt fqs because if
i use '&' like :
admin_directory_search_geolocation?q=david&fq=({!geofilt&sfield=adminLatLon&pt=33.0198431,-96.6988856&d=80})+OR+({!geofilt&sfield=adminLatLon&pt=50.2171726,8.265894&d=80})

then it gives me error as it takes ")" paranthesis as part of d=80



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html