Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(query): Use full form for match_phrase query #100

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions layout/AddressesUsingIdsQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ function createAddressShould(vs) {
must: [
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber')
'address_parts.number': {
query: vs.var('input:housenumber')
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street')
'address_parts.street': {
query: vs.var('input:street')
}
}
}
],
Expand All @@ -41,17 +45,23 @@ function createUnitAndAddressShould(vs) {
must: [
{
match_phrase: {
'address_parts.unit': vs.var('input:unit')
'address_parts.unit': {
query: vs.var('input:unit')
}
}
},
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber')
'address_parts.number': {
query: vs.var('input:housenumber')
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street')
'address_parts.street': {
query: vs.var('input:street')
}
}
}
],
Expand All @@ -77,17 +87,23 @@ function createPostcodeAndAddressShould(vs) {
must: [
{
match_phrase: {
'address_parts.zip': vs.var('input:postcode')
'address_parts.zip': {
query: vs.var('input:postcode')
}
}
},
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber')
'address_parts.number': {
query: vs.var('input:housenumber')
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street')
'address_parts.street': {
query: vs.var('input:street')
}
}
}
],
Expand All @@ -113,7 +129,9 @@ function createStreetShould(vs) {
must: [
{
match_phrase: {
'address_parts.street': vs.var('input:street')
'address_parts.street': {
query: vs.var('input:street')
}
}
}
],
Expand Down
32 changes: 24 additions & 8 deletions layout/FallbackQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ function addPrimary(value, layer, fields, likely_to_have_abbreviation) {
// o.bool.must.push(
// {
// match_phrase: {
// 'phrase.default': value
// 'phrase.default': {
// query: value
// }
// }
// }
// );
Expand Down Expand Up @@ -110,7 +112,9 @@ function addSecPostCode(vs, o) {
if (vs.isset('input:postcode')) {
o.bool.should.push({
match_phrase: {
'address_parts.zip': vs.var('input:postcode').toString()
'address_parts.zip': {
query: vs.var('input:postcode').toString()
}
}
});
}
Expand Down Expand Up @@ -231,17 +235,23 @@ function addUnitAndHouseNumberAndStreet(vs) {
must: [
{
match_phrase: {
'address_parts.unit': vs.var('input:unit').toString()
'address_parts.unit': {
query: vs.var('input:unit').toString()
}
}
},
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber').toString()
'address_parts.number': {
query: vs.var('input:housenumber').toString()
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
'address_parts.street': {
query: vs.var('input:street').toString()
}
}
}
],
Expand Down Expand Up @@ -277,12 +287,16 @@ function addHouseNumberAndStreet(vs) {
must: [
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber').toString()
'address_parts.number': {
query: vs.var('input:housenumber').toString()
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
'address_parts.street': {
query: vs.var('input:street').toString()
}
}
}
],
Expand Down Expand Up @@ -318,7 +332,9 @@ function addStreet(vs) {
must: [
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
'address_parts.street': {
query: vs.var('input:street').toString()
}
}
}
],
Expand Down
32 changes: 24 additions & 8 deletions layout/StructuredFallbackQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ function addSecPostCode(vs, o) {
if (vs.isset('input:postcode')) {
o.bool.should.push({
match_phrase: {
'address_parts.zip': vs.var('input:postcode').toString()
'address_parts.zip': {
query: vs.var('input:postcode').toString()
}
}
});
}
Expand Down Expand Up @@ -192,17 +194,23 @@ function addUnitAndHouseNumberAndStreet(vs) {
must: [
{
match_phrase: {
'address_parts.unit': vs.var('input:unit').toString()
'address_parts.unit': {
query: vs.var('input:unit').toString()
}
}
},
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber').toString()
'address_parts.number': {
query: vs.var('input:housenumber').toString()
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
'address_parts.street': {
query: vs.var('input:street').toString()
}
}
}
],
Expand Down Expand Up @@ -238,7 +246,9 @@ function addHouseNumber(vs) {
must: [
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber').toString()
'address_parts.number': {
query: vs.var('input:housenumber').toString()
}
}
}
],
Expand Down Expand Up @@ -273,12 +283,16 @@ function addHouseNumberAndStreet(vs) {
must: [
{
match_phrase: {
'address_parts.number': vs.var('input:housenumber').toString()
'address_parts.number': {
query: vs.var('input:housenumber').toString()
}
}
},
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
'address_parts.street': {
query: vs.var('input:street').toString()
}
}
}
],
Expand Down Expand Up @@ -314,7 +328,9 @@ function addStreet(vs) {
must: [
{
match_phrase: {
'address_parts.street': vs.var('input:street').toString()
'address_parts.street': {
query: vs.var('input:street').toString()
}
}
}
],
Expand Down
12 changes: 9 additions & 3 deletions test/fixtures/addressesUsingIdsQuery/housenumber_no_units.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"must": [
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand All @@ -28,12 +30,16 @@
"must": [
{
"match_phrase": {
"address_parts.number": "housenumber value"
"address_parts.number": {
"query": "housenumber value"
}
}
},
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/addressesUsingIdsQuery/no_housenumber.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"must": [
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand Down
28 changes: 21 additions & 7 deletions test/fixtures/addressesUsingIdsQuery/no_layers.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"must": [
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand All @@ -28,17 +30,23 @@
"must": [
{
"match_phrase": {
"address_parts.zip": "postcode value"
"address_parts.zip": {
"query": "postcode value"
}
}
},
{
"match_phrase": {
"address_parts.number": "housenumber value"
"address_parts.number": {
"query": "housenumber value"
}
}
},
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand All @@ -55,17 +63,23 @@
"must": [
{
"match_phrase": {
"address_parts.unit": "unit value"
"address_parts.unit": {
"query": "unit value"
}
}
},
{
"match_phrase": {
"address_parts.number": "housenumber value"
"address_parts.number": {
"query": "housenumber value"
}
}
},
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand Down
16 changes: 12 additions & 4 deletions test/fixtures/addressesUsingIdsQuery/no_layers_with_boosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"must": [
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand All @@ -30,17 +32,23 @@
"must": [
{
"match_phrase": {
"address_parts.unit": "unit value"
"address_parts.unit": {
"query": "unit value"
}
}
},
{
"match_phrase": {
"address_parts.number": "housenumber value"
"address_parts.number": {
"query": "housenumber value"
}
}
},
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"must": [
{
"match_phrase": {
"address_parts.street": "street value"
"address_parts.street": {
"query": "street value"
}
}
}
],
Expand Down
Loading