Browse Source

make exact matches of street higher priority than partial address

experiments
Diana Shkolnikov 8 years ago
parent
commit
121d86a0fc
  1. 4
      middleware/trimByGranularity.js

4
middleware/trimByGranularity.js

@ -16,8 +16,8 @@ var _ = require('lodash');
var layers = [ var layers = [
'venue', 'venue',
'address', 'address',
'address_partial',
'street', 'street',
'address_partial',
'street_partial', 'street_partial',
'neighbourhood', 'neighbourhood',
'borough', 'borough',
@ -35,7 +35,7 @@ var layers = [
// this helper method returns `true` if every result has a matched_query // this helper method returns `true` if every result has a matched_query
// starting with `fallback.` // starting with `fallback.`
function isFallbackQuery(results) { function isFallbackQuery(results) {
return results.every(function(result) { return results.every(function (result) {
return result.hasOwnProperty('_matched_queries') && return result.hasOwnProperty('_matched_queries') &&
!_.isEmpty(result._matched_queries) && !_.isEmpty(result._matched_queries) &&
_.startsWith(result._matched_queries[0], 'fallback.'); _.startsWith(result._matched_queries[0], 'fallback.');

Loading…
Cancel
Save