mysociety / popit-api

DEPRECATED - Development on PopIt has stopped and it is no longer being maintained
https://goo.gl/Vvej4Q
Other
17 stars 3 forks source link

the search endpoint should return the elasticsearch relevance score #96

Open mhl opened 9 years ago

mhl commented 9 years ago

When you make a search on a full name, for example, it would be very helpful to have the Elasticsearch relevance score returned in each result, so you can automatically tell how good a match the search result was. (I guess this might mean making relevance a reserved attribute in PopIt objects.)

tmtmtmtm commented 9 years ago

Merging application data with object data seems like a very bad path to go down. A better way to do this might be to make each search result its own object, with one field being the relevance, another the Person (or whatever), etc. This would avoid needing to add any reserved attributes, and would also make further expansions much easier too. It would be a significant change to how search works though, so it would probably need to be a new endpoint or at least an option to the search.

mhl commented 9 years ago

The reason I was suggesting that was to keep the API the same, but I suppose that strictly speaking it could break existing code anyway if anyone was using a field with this name. So, I'll assume search will need to return an extra wrapper around each result and add this to the "next API version" ticket.