|
|
@ -13,7 +13,29 @@ query.score( peliasQuery.view.ngrams, 'must' ); |
|
|
|
|
|
|
|
|
|
|
|
// scoring boost
|
|
|
|
// scoring boost
|
|
|
|
query.score( peliasQuery.view.phrase ); |
|
|
|
query.score( peliasQuery.view.phrase ); |
|
|
|
query.score( peliasQuery.view.focus( peliasQuery.view.ngrams ) ); |
|
|
|
|
|
|
|
|
|
|
|
var focus = peliasQuery.view.focus( peliasQuery.view.phrase ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _tmpview = function( vs ){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var view = focus( vs ); |
|
|
|
|
|
|
|
view.function_score.filter = { |
|
|
|
|
|
|
|
'or': [ |
|
|
|
|
|
|
|
{ 'type': { 'value': 'osmnode' } }, |
|
|
|
|
|
|
|
{ 'type': { 'value': 'osmway' } }, |
|
|
|
|
|
|
|
{ 'type': { 'value': 'osmaddress' } }, |
|
|
|
|
|
|
|
{ 'type': { 'value': 'openaddresses' } }, |
|
|
|
|
|
|
|
{ 'type': { 'value': 'geoname' } }, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log( JSON.stringify( view, null, 2 ) );
|
|
|
|
|
|
|
|
return view; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log( focus );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query.score( _tmpview ); |
|
|
|
query.score( peliasQuery.view.popularity( peliasQuery.view.phrase ) ); |
|
|
|
query.score( peliasQuery.view.popularity( peliasQuery.view.phrase ) ); |
|
|
|
query.score( peliasQuery.view.population( peliasQuery.view.phrase ) ); |
|
|
|
query.score( peliasQuery.view.population( peliasQuery.view.phrase ) ); |
|
|
|
|
|
|
|
|
|
|
@ -42,7 +64,11 @@ function generateQuery( clean ){ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return query.render( vs ); |
|
|
|
var q = query.render( vs ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log( JSON.stringify( q, null, 2 ) ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return q; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = generateQuery; |
|
|
|
module.exports = generateQuery; |
|
|
|