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

lucene-queryparser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucene-queryparser - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

152

lib/lucene-queryparser.js

@@ -196,3 +196,3 @@ if (typeof define !== 'function') { var define = require('amdefine')(module) };

function parse_node() {
var result0, result1, result2, result3;
var result0, result1, result2, result3, result4;
var pos0, pos1;

@@ -230,5 +230,27 @@

if (result0 !== null) {
result1 = parse_node();
result1 = parse_group_exp();
if (result1 !== null) {
result0 = [result0, result1];
result2 = [];
result3 = parse_operator_exp();
while (result3 !== null) {
result2.push(result3);
result3 = parse_operator_exp();
}
if (result2 !== null) {
result3 = [];
result4 = parse_node();
while (result4 !== null) {
result3.push(result4);
result4 = parse_node();
}
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {

@@ -243,11 +265,24 @@ result0 = null;

if (result0 !== null) {
result0 = (function(offset, operator, right) {
var node = Object.assign({}, right);
result0 = (function(offset, start, left, operator, right) {
var node = {
'start': start,
'left': left,
'operator': operator,
'right': right
};
if (operator === 'NOT') {
node.operator = operator;
var right =
right.length == 0
? null
: right[0]['right'] == null
? right[0]['left']
: right[0];
if (right != null) {
node['operator'] = operator == '' ? '<implicit>' : operator[0];
node['right'] = right;
}
return node;
})(pos0, result0[0], result0[1]);
})(pos0, result0[0], result0[1], result0[2], result0[3]);
}

@@ -260,23 +295,7 @@ if (result0 === null) {

pos1 = pos;
result0 = parse_group_exp();
result0 = parse_operator_exp();
if (result0 !== null) {
result1 = [];
result2 = parse_operator_exp();
while (result2 !== null) {
result1.push(result2);
result2 = parse_operator_exp();
}
result1 = parse_node();
if (result1 !== null) {
result2 = [];
result3 = parse_node();
while (result3 !== null) {
result2.push(result3);
result3 = parse_node();
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
result0 = [result0, result1];
} else {

@@ -291,21 +310,5 @@ result0 = null;

if (result0 !== null) {
result0 = (function(offset, left, operator, right) {
var node= {
'left':left
};
var right =
right.length == 0
? null
: right[0]['right'] == null
? right[0]['left']
: right[0];
if (right != null) {
node['operator'] = operator == '' ? '<implicit>' : operator[0];
node['right'] = right;
}
return node;
})(pos0, result0[0], result0[1], result0[2]);
result0 = (function(offset, operator, right) {
return right;
})(pos0, result0[0], result0[1]);
}

@@ -315,2 +318,59 @@ if (result0 === null) {

}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
result0 = parse_group_exp();
if (result0 !== null) {
result1 = [];
result2 = parse_operator_exp();
while (result2 !== null) {
result1.push(result2);
result2 = parse_operator_exp();
}
if (result1 !== null) {
result2 = [];
result3 = parse_node();
while (result3 !== null) {
result2.push(result3);
result3 = parse_node();
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, left, operator, right) {
var node = {
'left':left
};
var right =
right.length == 0
? null
: right[0]['right'] == null
? right[0]['left']
: right[0];
if (right != null) {
node['operator'] = operator == '' ? '<implicit>' : operator[0];
node['right'] = right;
}
return node;
})(pos0, result0[0], result0[1], result0[2]);
}
if (result0 === null) {
pos = pos0;
}
}
}

@@ -317,0 +377,0 @@ }

{
"name": "lucene-queryparser",
"version": "1.0.0",
"version": "2.0.0",
"description": "Lucene Query Parser for Javascript created using PEG.js",

@@ -5,0 +5,0 @@ "main": "lib/lucene-queryparser.js",

@@ -494,3 +494,3 @@ if (typeof define !== 'function') { var define = require('amdefine')(module) }

expect(results['left']['term']).toBe('jakarta apache');
expect(results['operator']).toBe('NOT');
expect(results['start']).toBe('NOT');
});

@@ -547,3 +547,20 @@

});
it('parses example: NOT (java OR python) AND android', function() {
var results = lucenequeryparser.parse('NOT (java OR python) AND android');
var leftNode = results['left'];
expect(results['start']).toBe('NOT');
expect(leftNode['left']['field']).toBe('<implicit>');
expect(leftNode['left']['term']).toBe('java');
expect(leftNode['operator']).toBe('OR');
expect(leftNode['right']['field']).toBe('<implicit>');
expect(leftNode['right']['term']).toBe('python');
expect(results['operator']).toBe('AND');
expect(results['right']['field']).toBe('<implicit>');
expect(results['right']['term']).toBe('android');
});
});
});

Sorry, the diff of this file is not supported yet

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