Mike-Heneghan / ALISS

ALISS (A Local Information System for Scotland) is a service to help you find help and support close to you when you need it most.
https://aliss.org
0 stars 0 forks source link

Add distance values to the service results. #63

Closed Mike-Heneghan closed 4 years ago

Mike-Heneghan commented 5 years ago

Elasticsearch returns a score in the metadata of results. These scores are floats and can be based on keyword matching, distance etc. The distance score is the direct distance between the lat/longs of the searched postcode and location and could be useful to users. To make these distances appear in the search results it would be necessary to pass this data to the view.

The end goal would be to return an object of services ids against placement in the sorted order and the distance value, i.e. :

distance_scores = {'service_id': {'place', 'score'}} 

These distance scores would only be returned when the results are filtered by distance.

It would be worthwhile manipulating Elasticsearch results in the shell to get to grips with the data and methods.

Mike-Heneghan commented 5 years ago

To do list:

Mike-Heneghan commented 5 years ago

Distance scores added to the service results:

Screenshot 2019-04-10 at 16 02 58
Mike-Heneghan commented 5 years ago

To do list:

Mike-Heneghan commented 5 years ago

After merging with the custom radius code notices that results with distance values greater than 1km were showing up in results with the 1km filter. Realised this is due to the service areas.

https://github.com/Mike-Heneghan/ALISS/issues/67

Might need to compare the custom radius and check that if it's bigger then to remove the distance value?

Mike-Heneghan commented 5 years ago

Created a screenshot of service with location 7.28km away appearing with a radius search of 1km due to differences between coverage and service location.

Screenshot 2019-04-12 at 09 37 32
Mike-Heneghan commented 5 years ago

Due to the confusion generated by showing a distance outwith the radius either need to change the language of it to make it clear it's a distance to that particular location but not service coverage.

Or alternatively, I've created another method in the view that compares the distance score with the search radius and removed the distance information if the location is technically out of range. This only affects whether or not the "Distance: 19.97(km) appears or not and does not affect whether or now the service is shown.

Screenshot 2019-04-12 at 10 23 36 Screenshot 2019-04-12 at 10 23 21
Mike-Heneghan commented 4 years ago

Merged into master