Browse Source

Using new layers view to filter layers

pull/580/head
Alec Vulfson 9 years ago committed by Julian Simioni
parent
commit
31adf09870
No known key found for this signature in database
GPG Key ID: 6DAD08919FDBF563
  1. 5
      controller/search.js
  2. 4
      query/search.js
  3. 11
      test/unit/fixture/search_boundary_country.js
  4. 18
      test/unit/fixture/search_full_address.js
  5. 13
      test/unit/fixture/search_linguistic_bbox.js
  6. 11
      test/unit/fixture/search_linguistic_focus.js
  7. 11
      test/unit/fixture/search_linguistic_focus_bbox.js
  8. 7
      test/unit/fixture/search_linguistic_focus_null_island.js
  9. 11
      test/unit/fixture/search_linguistic_only.js
  10. 9
      test/unit/fixture/search_linguistic_viewport.js
  11. 18
      test/unit/fixture/search_partial_address.js
  12. 18
      test/unit/fixture/search_regions_address.js

5
controller/search.js

@ -31,11 +31,6 @@ function setup( backend, query ){
body: query( req.clean )
};
// use layers field for filtering by type
if( req.clean.hasOwnProperty('layers') ){
cmd.type = req.clean.layers;
}
logger.debug( '[ES req]', cmd );
// query backend

4
query/search.js

@ -43,6 +43,7 @@ query.score( peliasQuery.view.admin_multi_match(adminFields, 'peliasAdmin') );
query.filter( peliasQuery.view.boundary_circle );
query.filter( peliasQuery.view.boundary_rect );
query.filter( peliasQuery.view.sources );
query.filter( peliasQuery.view.layers );
// --------------------------------
/**
@ -59,6 +60,9 @@ function generateQuery( clean ){
// sources
vs.var( 'sources', clean.sources);
// layers
vs.var( 'layers', clean.layers);
// size
if( clean.querySize ) {
vs.var( 'size', clean.querySize );

11
test/unit/fixture/search_boundary_country.js

@ -81,7 +81,16 @@ module.exports = {
'weight': 2
}]
}
}]
}],
'filter': [
{
'terms': {
'layer': [
'test'
]
}
}
]
}
},
'sort': [ '_score' ],

18
test/unit/fixture/search_full_address.js

@ -128,7 +128,23 @@ module.exports = {
'query': 'new york',
'analyzer': 'peliasAdmin'
}
}]
}],
'filter': [
{
'terms': {
'layer': [
'address',
'venue',
'country',
'region',
'county',
'neighbourhood',
'locality',
'localadmin'
]
}
}
]
}
},
'size': 10,

13
test/unit/fixture/search_linguistic_bbox.js

@ -74,14 +74,21 @@ module.exports = {
}],
'filter': [{
'geo_bounding_box': {
'type': 'indexed',
'center_point': {
'top': 11.51,
'right': -61.84,
'bottom': 47.47,
'left': -103.16
},
'type': 'indexed'
}
}
}
},
{
'terms': {
'layer': [
'test'
]
}
}]
}
},

11
test/unit/fixture/search_linguistic_focus.js

@ -101,7 +101,16 @@ module.exports = {
'weight': 2
}]
}
}]
}],
'filter': [
{
'terms': {
'layer': [
'test'
]
}
}
]
}
},
'sort': [ '_score' ],

11
test/unit/fixture/search_linguistic_focus_bbox.js

@ -104,13 +104,20 @@ module.exports = {
}],
'filter': [{
'geo_bounding_box': {
'type': 'indexed',
'center_point': {
'top': 11.51,
'right': -61.84,
'bottom': 47.47,
'left': -103.16
},
'type': 'indexed'
}
}
},
{
'terms': {
'layer': [
'test'
]
}
}]
}

7
test/unit/fixture/search_linguistic_focus_null_island.js

@ -101,6 +101,13 @@ module.exports = {
'weight': 2
}]
}
}],
'filter':[{
'terms': {
'layer': [
'test'
]
}
}]
}
},

11
test/unit/fixture/search_linguistic_only.js

@ -71,7 +71,16 @@ module.exports = {
'weight': 2
}]
}
}]
}],
'filter': [
{
'terms': {
'layer': [
'test'
]
}
}
]
}
},
'sort': [ '_score' ],

9
test/unit/fixture/search_linguistic_viewport.js

@ -113,6 +113,15 @@ module.exports = {
'boost_mode': 'replace'
}
}
],
'filter': [
{
'terms': {
'layer': [
'test'
]
}
}
]
}
},

18
test/unit/fixture/search_partial_address.js

@ -96,7 +96,23 @@ module.exports = {
'query': 'new york',
'analyzer': 'peliasAdmin'
}
}]
}],
'filter': [
{
'terms': {
'layer': [
'address',
'venue',
'country',
'region',
'county',
'neighbourhood',
'locality',
'localadmin'
]
}
}
]
}
},
'size': 10,

18
test/unit/fixture/search_regions_address.js

@ -112,7 +112,23 @@ module.exports = {
'query': 'manhattan',
'analyzer': 'peliasAdmin'
}
}]
}],
'filter': [
{
'terms': {
'layer': [
'address',
'venue',
'country',
'region',
'county',
'neighbourhood',
'locality',
'localadmin'
]
}
}
]
}
},
'size': 10,

Loading…
Cancel
Save