Skip to content

Commit

Permalink
chore(release): 6.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
krisk committed Jun 24, 2020
1 parent e357229 commit f8ec28f
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 97 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [6.3.1](https://github.com/krisk/Fuse/compare/v6.3.0...v6.3.1) (2020-06-24)


### Bug Fixes

* **logical:** scores in logical query operators are ignored ([e357229](https://github.com/krisk/Fuse/commit/e357229846fff585707903c93f556d1562fbabba)), closes [#449](https://github.com/krisk/Fuse/issues/449)

## [6.3.0](https://github.com/krisk/Fuse/compare/v6.2.1...v6.3.0) (2020-06-23)


Expand Down
9 changes: 5 additions & 4 deletions dist/fuse.basic.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Fuse.js v6.3.0 - Lightweight fuzzy-search (http://fusejs.io)
* Fuse.js v6.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2020 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
Expand Down Expand Up @@ -297,9 +297,10 @@ function get(obj, path) {
deepGet(value, path, index + 1);
}
}
};
}; // Backwards compatibility (since path used to be a string)


deepGet(obj, path, 0);
deepGet(obj, isString(path) ? path.split('.') : path, 0);
return arr ? list : list[0];
}

Expand Down Expand Up @@ -1426,7 +1427,7 @@ function format(results, docs) {
});
}

Fuse.version = '6.3.0';
Fuse.version = '6.3.1';
Fuse.createIndex = createIndex;
Fuse.parseIndex = parseIndex;
Fuse.config = Config;
Expand Down
7 changes: 4 additions & 3 deletions dist/fuse.basic.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Fuse.js v6.3.0 - Lightweight fuzzy-search (http://fusejs.io)
* Fuse.js v6.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2020 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
Expand Down Expand Up @@ -175,7 +175,8 @@ function get(obj, path) {
}
};

deepGet(obj, path, 0);
// Backwards compatibility (since path used to be a string)
deepGet(obj, isString(path) ? path.split('.') : path, 0);

return arr ? list : list[0]
}
Expand Down Expand Up @@ -1198,7 +1199,7 @@ function format(
})
}

Fuse.version = '6.3.0';
Fuse.version = '6.3.1';
Fuse.createIndex = createIndex;
Fuse.parseIndex = parseIndex;
Fuse.config = Config;
Expand Down
4 changes: 2 additions & 2 deletions dist/fuse.basic.esm.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions dist/fuse.basic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Fuse.js v6.3.0 - Lightweight fuzzy-search (http://fusejs.io)
* Fuse.js v6.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2020 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
Expand Down Expand Up @@ -301,9 +301,10 @@
deepGet(value, path, index + 1);
}
}
};
}; // Backwards compatibility (since path used to be a string)


deepGet(obj, path, 0);
deepGet(obj, isString(path) ? path.split('.') : path, 0);
return arr ? list : list[0];
}

Expand Down Expand Up @@ -1430,7 +1431,7 @@
});
}

Fuse.version = '6.3.0';
Fuse.version = '6.3.1';
Fuse.createIndex = createIndex;
Fuse.parseIndex = parseIndex;
Fuse.config = Config;
Expand Down
4 changes: 2 additions & 2 deletions dist/fuse.basic.min.js

Large diffs are not rendered by default.

99 changes: 61 additions & 38 deletions dist/fuse.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Fuse.js v6.3.0 - Lightweight fuzzy-search (http://fusejs.io)
* Fuse.js v6.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2020 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
Expand Down Expand Up @@ -375,9 +375,10 @@ function get(obj, path) {
deepGet(value, path, index + 1);
}
}
};
}; // Backwards compatibility (since path used to be a string)


deepGet(obj, path, 0);
deepGet(obj, isString(path) ? path.split('.') : path, 0);
return arr ? list : list[0];
}

Expand Down Expand Up @@ -1916,58 +1917,80 @@ var Fuse = /*#__PURE__*/function () {
var _this = this;

var expression = parse(query, this.options);
var records = this._myIndex.records;
var resultMap = {};
var results = [];

var evaluateExpression = function evaluateExpression(node, item, idx) {
if (node.children) {
var operator = node.operator;
var res = [];
var evaluate = function evaluate(node, item, idx) {
if (!node.children) {
var keyId = node.keyId,
searcher = node.searcher;

for (var k = 0; k < node.children.length; k += 1) {
var child = node.children[k];
var matches = evaluateExpression(child, item, idx);
var matches = _this._findMatches({
key: _this._keyStore.get(keyId),
value: _this._myIndex.getValueForItemAtKeyId(item, keyId),
searcher: searcher
});

if (matches && matches.length) {
res.push({
idx: idx,
item: item,
matches: matches
});
if (matches && matches.length) {
return [{
idx: idx,
item: item,
matches: matches
}];
}

return [];
}
/*eslint indent: [2, 2, {"SwitchCase": 1}]*/

if (operator === LogicalOperator.OR) {
// Short-circuit
break;

switch (node.operator) {
case LogicalOperator.AND:
{
var res = [];

for (var i = 0, len = node.children.length; i < len; i += 1) {
var child = node.children[i];
var result = evaluate(child, item, idx);

if (result.length) {
res.push.apply(res, _toConsumableArray(result));
} else {
return [];
}
}
} else if (operator === LogicalOperator.AND) {
res.length = 0; // Short-circuit

break;
return res;
}
}

return res;
} else {
var keyId = node.keyId,
searcher = node.searcher;
case LogicalOperator.OR:
{
var _res = [];

var value = _this._myIndex.getValueForItemAtKeyId(item, keyId);
for (var _i = 0, _len = node.children.length; _i < _len; _i += 1) {
var _child = node.children[_i];

return _this._findMatches({
key: _this._keyStore.get(keyId),
value: value,
searcher: searcher
});
var _result = evaluate(_child, item, idx);

if (_result.length) {
_res.push.apply(_res, _toConsumableArray(_result));

break;
}
}

return _res;
}
}
};

var records = this._myIndex.records;
var resultMap = {};
var results = [];
records.forEach(function (_ref3) {
var item = _ref3.$,
idx = _ref3.i;

if (isDefined(item)) {
var expResults = evaluateExpression(expression, item, idx);
var expResults = evaluate(expression, item, idx);

if (expResults.length) {
// Dedupe when adding
Expand Down Expand Up @@ -2140,7 +2163,7 @@ function format(results, docs) {
});
}

Fuse.version = '6.3.0';
Fuse.version = '6.3.1';
Fuse.createIndex = createIndex;
Fuse.parseIndex = parseIndex;
Fuse.config = Config;
Expand Down
2 changes: 1 addition & 1 deletion dist/fuse.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for Fuse.js v6.3.0
// Type definitions for Fuse.js v6.3.1
// TypeScript v3.9.5

export default Fuse
Expand Down
86 changes: 50 additions & 36 deletions dist/fuse.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Fuse.js v6.3.0 - Lightweight fuzzy-search (http://fusejs.io)
* Fuse.js v6.3.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2020 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
Expand Down Expand Up @@ -173,7 +173,8 @@ function get(obj, path) {
}
};

deepGet(obj, path, 0);
// Backwards compatibility (since path used to be a string)
deepGet(obj, isString(path) ? path.split('.') : path, 0);

return arr ? list : list[0]
}
Expand Down Expand Up @@ -1493,53 +1494,66 @@ class Fuse {

const expression = parse(query, this.options);

const records = this._myIndex.records;
const resultMap = {};
const results = [];

const evaluateExpression = (node, item, idx) => {
if (node.children) {
const operator = node.operator;
let res = [];
const evaluate = (node, item, idx) => {
if (!node.children) {
const { keyId, searcher } = node;

for (let k = 0; k < node.children.length; k += 1) {
let child = node.children[k];
let matches = evaluateExpression(child, item, idx);
const matches = this._findMatches({
key: this._keyStore.get(keyId),
value: this._myIndex.getValueForItemAtKeyId(item, keyId),
searcher
});

if (matches && matches.length) {
res.push({
if (matches && matches.length) {
return [
{
idx,
item,
matches
});
if (operator === LogicalOperator.OR) {
// Short-circuit
break
}
} else if (operator === LogicalOperator.AND) {
res.length = 0;
// Short-circuit
break
}
]
}

return res
} else {
const { keyId, searcher } = node;

const value = this._myIndex.getValueForItemAtKeyId(item, keyId);
return []
}

return this._findMatches({
key: this._keyStore.get(keyId),
value,
searcher
})
/*eslint indent: [2, 2, {"SwitchCase": 1}]*/
switch (node.operator) {
case LogicalOperator.AND: {
const res = [];
for (let i = 0, len = node.children.length; i < len; i += 1) {
const child = node.children[i];
const result = evaluate(child, item, idx);
if (result.length) {
res.push(...result);
} else {
return []
}
}
return res
}
case LogicalOperator.OR: {
const res = [];
for (let i = 0, len = node.children.length; i < len; i += 1) {
const child = node.children[i];
const result = evaluate(child, item, idx);
if (result.length) {
res.push(...result);
break
}
}
return res
}
}
};

const records = this._myIndex.records;
const resultMap = {};
const results = [];

records.forEach(({ $: item, i: idx }) => {
if (isDefined(item)) {
let expResults = evaluateExpression(expression, item, idx);
let expResults = evaluate(expression, item, idx);

if (expResults.length) {
// Dedupe when adding
Expand Down Expand Up @@ -1685,7 +1699,7 @@ function format(
})
}

Fuse.version = '6.3.0';
Fuse.version = '6.3.1';
Fuse.createIndex = createIndex;
Fuse.parseIndex = parseIndex;
Fuse.config = Config;
Expand Down
Loading

0 comments on commit f8ec28f

Please sign in to comment.