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

lunr

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lunr - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

11

lib/builder.js

@@ -222,5 +222,12 @@ /*!

idf = lunr.idf(this.invertedIndex[term], this.documentCount),
score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (documentLength / this.averageDocumentLength)) + tf)
score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (documentLength / this.averageDocumentLength)) + tf),
scoreWithPrecision = Math.round(score * 1000) / 1000
// Converts 1.23456789 to 1.234.
// Reducing the precision so that the vectors take up less
// space when serialised. Doing it now so that they behave
// the same before and after serialisation. Also, this is
// the fastest approach to reducing a number's precision in
// JavaScript.
documentVector.insert(termIndex, score)
documentVector.insert(termIndex, scoreWithPrecision)
}

@@ -227,0 +234,0 @@

@@ -117,2 +117,15 @@ lunr.QueryLexer = function (str) {

// This matches the separator used when tokenising fields
// within a document. These should match otherwise it is
// not possible to search for some tokens within a document.
//
// It is possible for the user to change the separator on the
// tokenizer so it _might_ clash with any other of the special
// characters already used within the search string, e.g. :.
//
// This means that it is possible to change the separator in
// such a way that makes some words unsearchable using a search
// string.
lunr.QueryLexer.termSeparator = lunr.tokenizer.separator
lunr.QueryLexer.lexText = function (lexer) {

@@ -146,4 +159,3 @@ while (true) {

// TODO: there may be more separators we want to consider
if (char == " ") {
if (char.match(lunr.QueryLexer.termSeparator)) {
return lunr.QueryLexer.lexTerm

@@ -150,0 +162,0 @@ }

2

package.json
{
"name": "lunr",
"description": "Simple full-text search in your browser.",
"version": "2.0.1",
"version": "2.0.2",
"author": "Oliver Nightingale",

@@ -6,0 +6,0 @@ "keywords": ["search"],

@@ -116,2 +116,12 @@ suite('lunr.QueryLexer', function () {

suite('hyphen (-) considered a seperator', function () {
setup(function () {
this.lexer = lex('foo-bar')
})
test('produces 1 lexeme', function () {
assert.lengthOf(this.lexer.lexemes, 2)
})
})
suite('term with field', function () {

@@ -118,0 +128,0 @@ setup(function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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