
Product
Rubygems Ecosystem Support Now Generally Available
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
lucene-query-string-builder
Advanced tools
More easily build your lucene string queries using small and pure functions.
The usage section shows how you can leverage this lib for your purposes.
Imagine having an API that leverages lucene for performing queries on the (indexed) database. In that case you might want to generate lucene query strings on the client/front end.
bower install lucene-query-builder --save
# or
npm install lucene-query-builder --save
Let's see how you can use lucene query string builder to define lucene query strings with simple JavaScript functions.
Assuming that the lucene global variable contains the lucene functions. This would be the default when loaded into a browser.
var findUserLuceneQueryString = lucene.builder(function(data){
// just to make the example more readable;
var _ = lucene;
_.group(_.and(
_.field('eye-color', _.term(data.eye.color)),
_.field('age', _.range(data.age.min, data.age.max))
));
});
var luceneQueryString = findUserLuceneQueryString({
eye: { color: 'brown'},
age: {
min: 10,
max: 20
}
});
luceneQueryString == "( eye-color: "brown" AND age:{ 10 TO 20 } )" // => true
The list of all the functions available are. They are based on the specifications which can be found here:
https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Terms
terms
term
field
or
and
not
group
range;
fuzzy;
proximity
required
builder
Make sure your dependencies are installed by running: npm run-script setup
Then start editing the index.js
You should add and/or edit the tests in test/index.js
Run your tests and see what happens
When performing pull request make sure to not add the dist files. This is left to the maintainers(s) of the library. They are responsible to version and avoid code breakages.
You can perform your own build with npm run-script
build to make a lucine.js and
a lucine.min.js
notice
I am currently not using this repository in any of my projects. Therefore I am looking for people that are able to make LQSB more useful for them and others.
The MIT License (MIT)
FAQs
Build Lucene queries by defining lucene query builders
The npm package lucene-query-string-builder receives a total of 397 weekly downloads. As such, lucene-query-string-builder popularity was classified as not popular.
We found that lucene-query-string-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.