You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

lucene-query-builder

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucene-query-builder - npm Package Compare versions

Comparing version

to
0.7.6

12

lib/cjs/functions/processPhrase.js

@@ -15,13 +15,7 @@ "use strict";

return '*:*';
phrase = phrase.trim();
let words = phrase.split(/\s+/);
// Single word - apply fuzzy search or append wildcard
if (words.length === 1)
return `"${words[0]}"*`;
// Multiple words - apply fuzzy and proximity search
words = words.map((word) => {
return word.length >= fuzzyLetters ? `${word}~${fuzzyLevel}` : word;
const words = phrase.trim().split(/\s+/).map((word, index) => {
return word.length >= fuzzyLetters ? `${word}~` : word;
});
return `"${words.join(' ')}"~${proximity}`;
return `${words.join('+')}`;
};
exports.processPhrase = processPhrase;

@@ -11,4 +11,4 @@ "use strict";

const query = ({ phrase = '', and = [], not = [], dates, options = {}, } = {}) => {
const { fuzzyLetters, fuzzyLevel, urlEncoded } = options;
const phraseQuery = (0, processPhrase_1.processPhrase)(phrase, { fuzzyLetters, fuzzyLevel });
const { fuzzyLetters, fuzzyLevel, urlEncoded, proximity } = options;
const phraseQuery = (0, processPhrase_1.processPhrase)(phrase, { fuzzyLetters, fuzzyLevel, proximity });
const andQuery = (0, processTerms_1.processTerms)(and, 'AND');

@@ -15,0 +15,0 @@ const notQuery = (0, processTerms_1.processTerms)(not, 'NOT');

@@ -12,12 +12,6 @@ import { defaultValues } from '../constants/defaultValues';

return '*:*';
phrase = phrase.trim();
let words = phrase.split(/\s+/);
// Single word - apply fuzzy search or append wildcard
if (words.length === 1)
return `"${words[0]}"*`;
// Multiple words - apply fuzzy and proximity search
words = words.map((word) => {
return word.length >= fuzzyLetters ? `${word}~${fuzzyLevel}` : word;
const words = phrase.trim().split(/\s+/).map((word, index) => {
return word.length >= fuzzyLetters ? `${word}~` : word;
});
return `"${words.join(' ')}"~${proximity}`;
return `${words.join('+')}`;
};

@@ -8,4 +8,4 @@ import { processPhrase } from './functions/processPhrase';

export const query = ({ phrase = '', and = [], not = [], dates, options = {}, } = {}) => {
const { fuzzyLetters, fuzzyLevel, urlEncoded } = options;
const phraseQuery = processPhrase(phrase, { fuzzyLetters, fuzzyLevel });
const { fuzzyLetters, fuzzyLevel, urlEncoded, proximity } = options;
const phraseQuery = processPhrase(phrase, { fuzzyLetters, fuzzyLevel, proximity });
const andQuery = processTerms(and, 'AND');

@@ -12,0 +12,0 @@ const notQuery = processTerms(not, 'NOT');

{
"name": "lucene-query-builder",
"version": "0.7.5",
"version": "0.7.6",
"description": "Library to build lucene queries in a typescript friendly way",

@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js",