Searching by coordinate location on Blacklight

54 views
Skip to first unread message

Dinis Sousa

unread,
Dec 23, 2023, 12:17:02 PM12/23/23
to Blacklight Development
I want to implement a search field to search by coordinate and give results in ascending order of distance to the point.

localhost:8983/solr/conflicts/query?q=*&indent=true&fq=!geofilt&pt=45.15,-93.85&d=10000000&sfield=coordinate_location&sort=geodist()%20asc

I am using this query on Solr, which is working, but for now I could not incorporate into the website.

config.add_search_field('coordinate_location') do |field|
      field.label = 'Location'
      field.solr_parameters = {
        q: '*',
        fq: '!geofilt',
        sfield: 'coordinate_location',
        d: 10000000,
        pt: '0.0,0.0', #pt should be user iinput
        sort: 'geodist() asc'
      }
    end

How can i achieve this?

I am using Blacklight 8.1 and Solr 9.3
Reply all
Reply to author
Forward
0 new messages