Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pelias-query

Package Overview
Dependencies
Maintainers
5
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pelias-query - npm Package Compare versions

Comparing version 9.8.0 to 9.9.0

2

package.json
{
"name": "pelias-query",
"version": "9.8.0",
"version": "9.9.0",
"description": "An Elasticsearch query builder for Pelias",

@@ -5,0 +5,0 @@ "engines": {

@@ -37,5 +37,6 @@ var address = require('../../view/address')('asdf');

vs.var('address::boost', 'boost value');
vs.var('address::cutoff_frequency', 'cutoff_frequency value');
var falseyPropertyAddress = require('../../view/address')('');
var actual = address(vs);
var undefinedPropertyAddress = require('../../view/address')('');
var actual = undefinedPropertyAddress(vs);

@@ -53,5 +54,6 @@ t.equal(actual, null, 'should have returned null');

vs.var('address:0:boost', 'boost value');
vs.var('address:0:cutoff_frequency', 'cutoff_frequency value');
var falseyPropertyAddress = require('../../view/address')(0);
var actual = address(vs);
var numericPropertyAddress = require('../../view/address')(0);
var actual = numericPropertyAddress(vs);

@@ -69,5 +71,6 @@ t.equal(actual, null, 'should have returned null');

vs.var('address:false:boost', 'boost value');
vs.var('address:false:cutoff_frequency', 'cutoff_frequency value');
var falseyPropertyAddress = require('../../view/address')(false);
var actual = address(vs);
var actual = falseyPropertyAddress(vs);

@@ -103,2 +106,3 @@ t.equal(actual, null, 'should have returned null');

vs.var('address:asdf:boost', 'boost value');
vs.var('address:asdf:cutoff_frequency', 'cutoff_frequency value');

@@ -116,2 +120,5 @@ var actual = address(vs);

},
cutoff_frequency: {
$: 'cutoff_frequency value'
},
query: {

@@ -118,0 +125,0 @@ $: 'input value'

@@ -89,3 +89,35 @@ var admin = require('../../view/admin')('asdf');

});
};
module.exports.tests.cutoff_frequency = function(test, common) {
test('cutoff_frequency value used if provided', function(t) {
var vs = getBaseVariableStore();
vs.var('admin:asdf:cutoff_frequency', 'cutoff_frequency value');
var actual = admin(vs);
var expected = {
match: {
'field value': {
analyzer: {
$: 'analyzer value'
},
boost: {
$: 'boost value'
},
cutoff_frequency: {
$: 'cutoff_frequency value'
},
query: {
$: 'input value'
}
}
}
};
t.deepEquals(actual, expected, 'should have returned object');
t.end();
});
};

@@ -92,0 +124,0 @@

@@ -90,2 +90,26 @@ var ngrams = require('../../view/ngrams');

module.exports.tests.cutoff_frequency = function(test, common) {
test('cutoff_frequency variable should be presented in query', function(t) {
var store = getBaseVariableStore();
store.var('ngram:cutoff_frequency', 'cutoff_frequency value');
var actual = ngrams(store);
var expected = {
match: {
'field value': {
analyzer: { $: 'analyzer value' },
boost: { $: 'boost value' },
query: { $: 'name value' },
cutoff_frequency: { $: 'cutoff_frequency value' }
}
}
};
t.deepEquals(actual, expected, 'should have returned object with cutoff_frequency field');
t.end();
});
};
module.exports.all = function (tape, common) {

@@ -92,0 +116,0 @@ function test(name, testFunction) {

@@ -95,3 +95,29 @@ var phrase = require('../../view/phrase');

module.exports.tests.cutoff_frequency = function(test, common) {
test('cutoff_frequency variable should be presented in query', function(t) {
var store = getBaseVariableStore();
store.var('phrase:cutoff_frequency', 'cutoff_frequency value');
var actual = phrase(store);
var expected = {
match: {
'field value': {
analyzer: { $: 'analyzer value' },
type: 'phrase',
boost: { $: 'boost value' },
slop: { $: 'slop value' },
query: { $: 'name value' },
cutoff_frequency: { $: 'cutoff_frequency value' }
}
}
};
t.deepEquals(actual, expected, 'should have returned object with cutoff_frequency field');
t.end();
});
};
module.exports.all = function (tape, common) {

@@ -98,0 +124,0 @@ function test(name, testFunction) {

@@ -20,6 +20,6 @@

// base view
var view = { 'match': {} };
let view = { 'match': {} };
// match query
view.match[ vs.var('address:'+property+':field') ] = {
let section = view.match[ vs.var('address:'+property+':field') ] = {
analyzer: vs.var('address:'+property+':analyzer'),

@@ -30,4 +30,9 @@ boost: vs.var('address:'+property+':boost'),

// optional 'cutoff_frequency' property
if( vs.isset('address:'+property+':cutoff_frequency') ){
section.cutoff_frequency = vs.var('address:'+property+':cutoff_frequency');
}
return view;
};
};

@@ -20,6 +20,6 @@

// base view
var view = { 'match': {} };
let view = { 'match': {} };
// match query
view.match[ vs.var('admin:'+property+':field') ] = {
let section = view.match[ vs.var('admin:'+property+':field') ] = {
analyzer: vs.var('admin:'+property+':analyzer'),

@@ -30,4 +30,9 @@ boost: vs.var('admin:'+property+':boost'),

// optional 'cutoff_frequency' property
if( vs.isset('admin:'+property+':cutoff_frequency') ){
section.cutoff_frequency = vs.var('admin:'+property+':cutoff_frequency');
}
return view;
};
};

@@ -26,3 +26,7 @@

if (vs.isset('ngram:cutoff_frequency')) {
view.match[ vs.var('ngram:field') ].cutoff_frequency = vs.var('ngram:cutoff_frequency');
}
return view;
};

@@ -29,3 +29,7 @@

if (vs.isset('phrase:cutoff_frequency')) {
view.match[ vs.var('phrase:field') ].cutoff_frequency = vs.var('phrase:cutoff_frequency');
}
return view;
};
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc