Browse Source

Merge pull request #382 from pelias/reenable_address_parsing_for_autocomplete

Reenable address parsing for autocomplete
pull/388/head
Julian Simioni 9 years ago
parent
commit
d42e143d5e
  1. 17
      query/autocomplete.js

17
query/autocomplete.js

@ -1,8 +1,10 @@
var peliasQuery = require('pelias-query'),
defaults = require('./autocomplete_defaults'),
textParser = require('./text_parser'),
check = require('check-types');
//------------------------------
// autocomplete query
//------------------------------
@ -11,6 +13,16 @@ var query = new peliasQuery.layout.FilteredBooleanQuery();
// mandatory matches
query.score( peliasQuery.view.ngrams, 'must' );
// admin components
query.score( peliasQuery.view.admin('alpha3') );
query.score( peliasQuery.view.admin('admin0') );
query.score( peliasQuery.view.admin('admin1') );
query.score( peliasQuery.view.admin('admin1_abbr') );
query.score( peliasQuery.view.admin('admin2') );
query.score( peliasQuery.view.admin('local_admin') );
query.score( peliasQuery.view.admin('locality') );
query.score( peliasQuery.view.admin('neighborhood') );
// scoring boost
query.score( peliasQuery.view.phrase );
query.score( peliasQuery.view.focus( peliasQuery.view.ngrams ) );
@ -39,6 +51,11 @@ function generateQuery( clean ){
});
}
// run the address parser
if( clean.parsed_text ){
textParser( clean.parsed_text, vs );
}
return query.render( vs );
}

Loading…
Cancel
Save