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

Allow custom layers by removing the restriction for non-coarse layers #1631

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions query/reverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ function generateQuery( clean ){

// layers
if( _.isArray(clean.layers) && !_.isEmpty(clean.layers) ) {
// only include non-coarse layers
vs.var( 'layers', _.intersection(clean.layers, ['address', 'street', 'venue']));
vs.var( 'layers', clean.layers);
}

// focus point to score by distance
Expand Down
1 change: 0 additions & 1 deletion query/reverse_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = _.merge({}, peliasQuery.defaults, {

'size': 1,
'track_scores': true,
'layers': ['venue', 'address', 'street'],

'centroid:field': 'center_point',

Expand Down
21 changes: 0 additions & 21 deletions test/unit/query/reverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,27 +209,6 @@ module.exports.tests.layers = (test, common) => {

});

test('non-empty array clean.layers should only set non-coarse layers in vs', t => {
const clean = {
layers: all_layers
};

const query = proxyquire('../../../query/reverse', {
'pelias-query': {
layout: {
FilteredBooleanQuery: MockQuery
},
view: views,
Vars: require('pelias-query').Vars
},
'./reverse_defaults': {}
})(clean);

t.deepEquals(query.body.vs.var('layers').toString(), ['address', 'venue', 'street']);
t.end();

});

mansoor-sajjad marked this conversation as resolved.
Show resolved Hide resolved
};

module.exports.tests.focus_point = (test, common) => {
Expand Down