Browse Source

admin boost for sqrt(popularity), autocomplete focus not restricted to phrase matches

pull/294/head
Peter Johnson 9 years ago
parent
commit
80f419846d
  1. 4
      package.json
  2. 3
      query/autocomplete.js
  3. 3
      query/search.js
  4. 48
      test/unit/fixture/autocomplete_linguistic_focus.js
  5. 48
      test/unit/fixture/autocomplete_linguistic_focus_null_island.js
  6. 42
      test/unit/fixture/autocomplete_linguistic_only.js
  7. 42
      test/unit/fixture/search_boundary_country.js
  8. 42
      test/unit/fixture/search_full_address.js
  9. 42
      test/unit/fixture/search_linguistic_bbox.js
  10. 42
      test/unit/fixture/search_linguistic_focus.js
  11. 42
      test/unit/fixture/search_linguistic_focus_bbox.js
  12. 42
      test/unit/fixture/search_linguistic_focus_null_island.js
  13. 42
      test/unit/fixture/search_linguistic_only.js
  14. 42
      test/unit/fixture/search_partial_address.js
  15. 42
      test/unit/fixture/search_regions_address.js

4
package.json

@ -44,15 +44,15 @@
"geojson-extent": "^0.3.1",
"geolib": "^2.0.18",
"geopipes-elasticsearch-backend": "^0.2.0",
"lodash": "^3.10.1",
"iso3166-1": "^0.2.3",
"lodash": "^3.10.1",
"markdown": "0.5.0",
"microtime": "1.4.0",
"morgan": "1.5.2",
"pelias-config": "^1.0.1",
"pelias-esclient": "0.0.25",
"pelias-logger": "^0.0.8",
"pelias-query": "1.5.0",
"pelias-query": "2.0.0",
"pelias-schema": "1.0.0",
"pelias-suggester-pipeline": "2.0.2",
"stats-lite": "^1.0.3",

3
query/autocomplete.js

@ -13,7 +13,8 @@ query.score( peliasQuery.view.ngrams, 'must' );
// scoring boost
query.score( peliasQuery.view.phrase );
query.score( peliasQuery.view.focus );
query.score( peliasQuery.view.focus( peliasQuery.view.ngrams ) );
query.score( peliasQuery.view.popularity(['admin0','admin1','admin2']) );
// --------------------------------

3
query/search.js

@ -14,7 +14,8 @@ query.score( peliasQuery.view.ngrams, 'must' );
// scoring boost
query.score( peliasQuery.view.phrase );
query.score( peliasQuery.view.focus );
query.score( peliasQuery.view.focus( peliasQuery.view.phrase ) );
query.score( peliasQuery.view.popularity(['admin0','admin1','admin2']) );
// address components
query.score( peliasQuery.view.address('housenumber') );

48
test/unit/fixture/autocomplete_linguistic_focus.js

@ -27,11 +27,9 @@ module.exports = {
'function_score': {
'query': {
'match': {
'phrase.default': {
'analyzer': 'peliasPhrase',
'type': 'phrase',
'name.default': {
'analyzer': 'peliasOneEdgeGram',
'boost': 1,
'slop': 2,
'query': 'test'
}
}
@ -52,6 +50,48 @@ module.exports = {
'score_mode': 'avg',
'boost_mode': 'replace'
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

48
test/unit/fixture/autocomplete_linguistic_focus_null_island.js

@ -27,11 +27,9 @@ module.exports = {
'function_score': {
'query': {
'match': {
'phrase.default': {
'analyzer': 'peliasPhrase',
'type': 'phrase',
'name.default': {
'analyzer': 'peliasOneEdgeGram',
'boost': 1,
'slop': 2,
'query': 'test'
}
}
@ -52,6 +50,48 @@ module.exports = {
'score_mode': 'avg',
'boost_mode': 'replace'
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

42
test/unit/fixture/autocomplete_linguistic_only.js

@ -23,6 +23,48 @@ module.exports = {
'slop': 2
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

42
test/unit/fixture/search_boundary_country.js

@ -33,6 +33,48 @@ module.exports = {
'slop': 2
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

42
test/unit/fixture/search_full_address.js

@ -26,6 +26,48 @@ module.exports = {
'boost': 1
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
},{
'match': {
'address.number': {

42
test/unit/fixture/search_linguistic_bbox.js

@ -23,6 +23,48 @@ module.exports = {
'slop': 2
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
},

42
test/unit/fixture/search_linguistic_focus.js

@ -52,6 +52,48 @@ module.exports = {
'score_mode': 'avg',
'boost_mode': 'replace'
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

42
test/unit/fixture/search_linguistic_focus_bbox.js

@ -52,6 +52,48 @@ module.exports = {
'score_mode': 'avg',
'boost_mode': 'replace'
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
},

42
test/unit/fixture/search_linguistic_focus_null_island.js

@ -52,6 +52,48 @@ module.exports = {
'score_mode': 'avg',
'boost_mode': 'replace'
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

42
test/unit/fixture/search_linguistic_only.js

@ -23,6 +23,48 @@ module.exports = {
'slop': 2
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
}]
}
}

42
test/unit/fixture/search_partial_address.js

@ -26,6 +26,48 @@ module.exports = {
'boost': 1
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
},{
'match': {
'admin0': {

42
test/unit/fixture/search_regions_address.js

@ -26,6 +26,48 @@ module.exports = {
'boost': 1
}
}
},
{
'function_score': {
'query': {
'filtered': {
'filter': {
'exists': {
'field': 'popularity'
}
}
}
},
'max_boost': 2,
'score_mode': 'first',
'boost_mode': 'replace',
'filter': {
'or': [
{
'type': {
'value': 'admin0'
}
},
{
'type': {
'value': 'admin1'
}
},
{
'type': {
'value': 'admin2'
}
}
]
},
'functions': [{
'field_value_factor': {
'modifier': 'sqrt',
'field': 'popularity'
},
'weight': 1
}]
}
},{
'match': {
'address.number': {

Loading…
Cancel
Save