Socket
Socket
Sign inDemoInstall

pelias-query

Package Overview
Dependencies
2
Maintainers
5
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.9.0 to 8.10.0

58

layout/ComponentFallbackQuery.js
// This query is used for component geocodes, where the individual fields have
// been specified by the user and therefore doesn't need to be parsed. The main
// difference between this and FallbackQuery is that component geocoding contains
// the entire address in one field (`input:address`) whereas libpostal parses
// out the house number and street as separate field (`input:housenumber` and
// `input:street`). Because there is no reasonable way (at this time) to parse
// out house number and street from address, both the `address` and `street`
// layers must be queried for. It functions much like FallbackQuery but with a
// few notable exceptions:
// been specified by the user and therefore doesn't need to be parsed. It functions
// much like FallbackQuery but with (currently) one notable exceptions:
//
// - `address` is searched for in `name.default`
// - `fallback.street` is scored much higher than `fallback.address` because
// otherwise `address` queries rank much higher
//
// - if locality is available but borough isn't, query borough layer with locality value
// - boosts are hardcoded

@@ -195,26 +187,22 @@ var _ = require('lodash');

function addAddress(vs) {
function addHouseNumberAndStreet(vs) {
var o = {
bool: {
_name: 'fallback.address',
must: [],
must: [
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber').toString()
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
}
}
],
should: [],
filter: {
bool: {
must: [
{
term: {
layer: 'address'
}
},
{
query_string: {
default_field: 'name.default',
default_operator: 'AND',
analyzer: 'peliasQueryFullToken',
query: vs.var('input:address').toString()
}
}
]
term: {
layer: 'address'
}

@@ -248,3 +236,3 @@ }

match_phrase: {
'address_parts.street': vs.var('input:address').toString()
'address_parts.street': vs.var('input:street').toString()
}

@@ -460,4 +448,6 @@ }

if (vs.isset('input:address')) {
funcScoreShould.push(addAddress(vs));
if (vs.isset('input:housenumber') && vs.isset('input:street')) {
funcScoreShould.push(addHouseNumberAndStreet(vs));
}
if (vs.isset('input:street')) {
funcScoreShould.push(addStreet(vs));

@@ -464,0 +454,0 @@ }

{
"name": "pelias-query",
"version": "8.9.0",
"version": "8.10.0",
"description": "An Elasticsearch query builder for Pelias",

@@ -37,3 +37,3 @@ "engines": {

"tape": "^4.2.0",
"semantic-release": "^4.3.5"
"semantic-release": "^6.3.2"
},

@@ -40,0 +40,0 @@ "pre-commit": [

@@ -12,3 +12,14 @@ {

"_name": "fallback.address",
"must": [],
"must": [
{
"match_phrase": {
"address_parts.number": "house number value"
}
},
{
"match_phrase": {
"address_parts.street": "street value"
}
}
],
"should": [

@@ -22,18 +33,4 @@ {

"filter": {
"bool": {
"must": [
{
"term": {
"layer": "address"
}
},
{
"query_string": {
"default_field": "name.default",
"default_operator": "AND",
"analyzer": "peliasQueryFullToken",
"query": "address value"
}
}
]
"term": {
"layer": "address"
}

@@ -50,3 +47,3 @@ },

"match_phrase": {
"address_parts.street": "address value"
"address_parts.street": "street value"
}

@@ -53,0 +50,0 @@ }

@@ -14,2 +14,12 @@ {

{
"match_phrase": {
"address_parts.number": "house number value"
}
},
{
"match_phrase": {
"address_parts.street": "street value"
}
},
{
"multi_match": {

@@ -85,18 +95,4 @@ "query": "neighbourhood value",

"filter": {
"bool": {
"must": [
{
"term": {
"layer": "address"
}
},
{
"query_string": {
"default_field": "name.default",
"default_operator": "AND",
"analyzer": "peliasQueryFullToken",
"query": "address value"
}
}
]
"term": {
"layer": "address"
}

@@ -113,3 +109,3 @@ },

"match_phrase": {
"address_parts.street": "address value"
"address_parts.street": "street value"
}

@@ -116,0 +112,0 @@ },

@@ -45,3 +45,4 @@ var ComponentFallbackQuery = require('../../layout/ComponentFallbackQuery');

vs.var('track_scores', 'track_scores value');
vs.var('input:address', 'address value');
vs.var('input:housenumber', 'house number value');
vs.var('input:street', 'street value');
vs.var('input:neighbourhood', 'neighbourhood value');

@@ -68,3 +69,4 @@ vs.var('input:borough', 'borough value');

vs.var('track_scores', 'track_scores value');
vs.var('input:address', 'address value');
vs.var('input:housenumber', 'house number value');
vs.var('input:street', 'street value');
vs.var('input:postcode', 'postcode value');

@@ -71,0 +73,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc