|
|
@ -3,9 +3,11 @@ const defaults = require('./autocomplete_defaults'); |
|
|
|
const textParser = require('./text_parser_addressit'); |
|
|
|
const textParser = require('./text_parser_addressit'); |
|
|
|
const check = require('check-types'); |
|
|
|
const check = require('check-types'); |
|
|
|
const logger = require('pelias-logger').get('api'); |
|
|
|
const logger = require('pelias-logger').get('api'); |
|
|
|
|
|
|
|
const config = require('pelias-config').generate().api; |
|
|
|
|
|
|
|
|
|
|
|
// additional views (these may be merged in to pelias/query at a later date)
|
|
|
|
// additional views (these may be merged in to pelias/query at a later date)
|
|
|
|
var views = { |
|
|
|
var views = { |
|
|
|
|
|
|
|
custom_boosts: require('./view/boost_sources_and_layers'), |
|
|
|
ngrams_strict: require('./view/ngrams_strict'), |
|
|
|
ngrams_strict: require('./view/ngrams_strict'), |
|
|
|
ngrams_last_token_only: require('./view/ngrams_last_token_only'), |
|
|
|
ngrams_last_token_only: require('./view/ngrams_last_token_only'), |
|
|
|
phrase_first_tokens_only: require('./view/phrase_first_tokens_only'), |
|
|
|
phrase_first_tokens_only: require('./view/phrase_first_tokens_only'), |
|
|
@ -44,18 +46,8 @@ query.score( peliasQuery.view.focus( views.ngrams_strict ) ); |
|
|
|
query.score( peliasQuery.view.popularity( views.pop_subquery ) ); |
|
|
|
query.score( peliasQuery.view.popularity( views.pop_subquery ) ); |
|
|
|
query.score( peliasQuery.view.population( views.pop_subquery ) ); |
|
|
|
query.score( peliasQuery.view.population( views.pop_subquery ) ); |
|
|
|
|
|
|
|
|
|
|
|
const boostView = require( './view/boost_sources_and_layers' ); |
|
|
|
const boostConfig = config.customBoosts || {}; |
|
|
|
|
|
|
|
query.score( views.custom_boosts(config.customBoosts) ); |
|
|
|
const boostConfig = {}; //TODO: empty config to make functional tests pass for now
|
|
|
|
|
|
|
|
// example useful config:
|
|
|
|
|
|
|
|
//const boostConfig = {
|
|
|
|
|
|
|
|
//layer: {
|
|
|
|
|
|
|
|
//stops: 5,
|
|
|
|
|
|
|
|
//fare: 5,
|
|
|
|
|
|
|
|
//station: 1
|
|
|
|
|
|
|
|
//},
|
|
|
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
query.score( boostView(boostConfig) ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// non-scoring hard filters
|
|
|
|
// non-scoring hard filters
|
|
|
|
query.filter( peliasQuery.view.sources ); |
|
|
|
query.filter( peliasQuery.view.sources ); |
|
|
|