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

Membership search returns surprising results #146

Open chrismytton opened 9 years ago

chrismytton commented 9 years ago

@dracos has pointed towards some surprising behaviour in the membership search API. On https://yournextmp.popit.mysociety.org/api/v0.1/search/memberships?q=role:Member+of+Parliament the first result has the role of "Candidate" but you would expect it to have the role of "Member of Parliament".

I believe this is because posts are embedded in memberships in elasticsearch, the first result in the above search does indeed have a post where the role is "Member of parliament".

So there should be an option to restrict the search to only top level keys in the JSON document, or possibly a way to search memberships without search related people/organizations/posts.