pelias-query
Advanced tools
Comparing version 2.0.0 to 3.0.0
{ | ||
"name": "pelias-query", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
module.exports = function( types ){ | ||
module.exports = function( subview ){ | ||
return function( vs ){ | ||
// query section reduces the number of records which | ||
// the decay function is applied to. | ||
// we simply re-use the another view for the function query. | ||
if( !subview ){ return null; } // subview validation failed | ||
// validate required params | ||
@@ -15,18 +20,3 @@ if( !vs.isset('popularity:field') || | ||
function_score: { | ||
query: { | ||
'filtered': { | ||
'filter': { | ||
'exists': { | ||
'field': vs.var('popularity:field') | ||
} | ||
} | ||
} | ||
}, | ||
// filter: { | ||
// 'or': [ | ||
// { 'type': { 'value': 'admin0' } }, | ||
// { 'type': { 'value': 'admin1' } }, | ||
// { 'type': { 'value': 'admin2' } } | ||
// ] | ||
// }, | ||
query: subview( vs ), | ||
max_boost: vs.var('popularity:max_boost'), | ||
@@ -36,14 +26,10 @@ functions: [], | ||
boost_mode: 'replace', | ||
filter: { | ||
'exists': { | ||
'field': vs.var('popularity:field') | ||
} | ||
} | ||
} | ||
}; | ||
// a list of _types to target | ||
if( Array.isArray( types ) ){ | ||
view.function_score.filter = { | ||
or: types.map( function( type ){ | ||
return { type: { value: type } }; | ||
}) | ||
}; | ||
} | ||
view.function_score.functions.push({ | ||
@@ -59,2 +45,2 @@ field_value_factor: { | ||
}; | ||
}; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45874
1051