Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrrectly filter /place queries by layer #1036

Merged
merged 1 commit into from
Oct 24, 2017
Merged

Conversation

orangejulius
Copy link
Member

/place queries have been executing in a way where only the ID, but not the layer, has been considered when returning records from Elasticsearch.

It turns out this bug was introduced almost a year and a half ago in #407. A little, relatively unimportant bit of code was looking for a property called layers:

    const cmd = req.clean.ids.map( function(id) {
      return {
        _index: apiConfig.indexName,
        _type: id.layers,
        _id: id.id
      };
    });

The correct property was layer, so no filtering on layer was done in the resulting mget query.

There was never an acceptance test for these sorts of queries, but there is now one in pelias/acceptance-tests#446. The unit tests were enforcing the incorrect behavior.

Fixes pelias/pelias#643

`/place` queries have been executing in a way where only the ID, but not
the layer, has been considered when returning records from
Elasticsearch.

It turns out this bug was introduced almost a year and a half ago in
#407. A little, relatively unimportant
bit of code was looking for a property called `layers`:

```
    const cmd = req.clean.ids.map( function(id) {
      return {
        _index: apiConfig.indexName,
        _type: id.layers,
        _id: id.id
      };
    });
```

The correct property was `layer`, so no filtering on layer was done in
the resulting [mget](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html) query.

There was never an acceptance test for these sorts of queries, but there
is now one in pelias/acceptance-tests#446. The
unit tests were enforcing the incorrect behavior.

Fixes pelias/pelias#643
Copy link
Contributor

@dianashk dianashk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! 😬

@orangejulius orangejulius merged commit ffc0f45 into master Oct 24, 2017
@ghost ghost removed the in progress label Oct 24, 2017
@orangejulius orangejulius deleted the improve-place-query branch November 14, 2017 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants