Browse Source

WIP commit: add small boost for wof admin areas

other things too perhaps?
tmp_adjust_autocomplete_focus
Julian Simioni 8 years ago
parent
commit
cd9fa72a9c
No known key found for this signature in database
GPG Key ID: 6DAD08919FDBF563
  1. 30
      query/autocomplete.js
  2. 2
      query/search.js
  3. 32
      query/search_original.js

30
query/autocomplete.js

@ -45,6 +45,30 @@ query.score( views.boost_exact_matches );
query.score( views.focus_selected_layers( views.ngrams_strict ) ); query.score( views.focus_selected_layers( views.ngrams_strict ) );
query.score( peliasQuery.view.popularity( views.pop_subquery ) ); query.score( peliasQuery.view.popularity( views.pop_subquery ) );
query.score( peliasQuery.view.population( views.pop_subquery ) ); query.score( peliasQuery.view.population( views.pop_subquery ) );
query.score( function() { return {
terms: {
layer: [ "country", "region", "locality", "localadmin", "county", "borough"],
boost: 3
}
} });
query.score( function() { return {
bool: {
must: [{
terms: {
source: [ "whosonfirst"],
boost: 1.1
}
},
{
terms: {
layer: [ "country", "region", "locality", "localadmin", "county", "borough"],
}
}
]
}
};
});
// non-scoring hard filters // non-scoring hard filters
query.filter( peliasQuery.view.sources ); query.filter( peliasQuery.view.sources );
@ -128,9 +152,13 @@ function generateQuery( clean ){
textParser( clean.parsed_text, vs ); textParser( clean.parsed_text, vs );
} }
var q = query.render(vs);
console.log(JSON.stringify(q, null, 2));
return { return {
type: 'autocomplete', type: 'autocomplete',
body: query.render(vs) body: q
}; };
} }

2
query/search.js

@ -114,7 +114,7 @@ function generateQuery( clean ){
var q = getQuery(vs); var q = getQuery(vs);
//console.log(JSON.stringify(q, null, 2)); console.log(JSON.stringify(q, null, 2));
return q; return q;
} }

32
query/search_original.js

@ -25,6 +25,32 @@ query.score( peliasQuery.view.phrase );
query.score( peliasQuery.view.focus( peliasQuery.view.phrase ) ); query.score( peliasQuery.view.focus( peliasQuery.view.phrase ) );
query.score( peliasQuery.view.popularity( peliasQuery.view.phrase ) ); query.score( peliasQuery.view.popularity( peliasQuery.view.phrase ) );
query.score( peliasQuery.view.population( peliasQuery.view.phrase ) ); query.score( peliasQuery.view.population( peliasQuery.view.phrase ) );
query.score( function() { return {
query: {
terms: {
layer: [ "country", "region", "locality", "localadmin", "borough"],
boost: 5
}
}
} });
query.score( function() { return {
query: {
terms: {
layer: [ "county"],
boost: 3
}
}
} });
query.score( function() { return {
query: {
terms: {
source: [ "whosonfirst"],
boost: 3
}
}
} });
// address components // address components
query.score( peliasQuery.view.address('housenumber') ); query.score( peliasQuery.view.address('housenumber') );
@ -125,9 +151,13 @@ function generateQuery( clean ){
textParser( clean.parsed_text, vs ); textParser( clean.parsed_text, vs );
} }
var q = query.render(vs);
console.log(JSON.stringify(q, null, 2));
return { return {
type: 'original', type: 'original',
body: query.render(vs) body: q
}; };
} }

Loading…
Cancel
Save