Skip to content

Commit

Permalink
Released 0.3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianreavis committed Oct 12, 2013
1 parent 1062342 commit b61431e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sifter",
"keywords": ["search","filter","sift","data","results","match","sort","autocomplete"],
"description": "A library for textually searching arrays and hashes of objects by property (or multiple properties). Designed specifically for autocomplete.",
"version": "0.2.0",
"version": "0.3.0",
"license": "Apache License, Version 2.0",
"readmeFilename": "README.md",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"autocomplete"
],
"description": "A library for textually searching arrays and hashes of objects by property (or multiple properties). Designed specifically for autocomplete.",
"version": "0.2.0",
"version": "0.3.0",
"author": "Brian Reavis <brian@thirdroute.com>",
"main": "./sifter.js",
"repository": {
Expand Down
25 changes: 19 additions & 6 deletions sifter.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,25 @@
return scoreObject(tokens[0], data);
};
}
return function(data) {
for (var i = 0, sum = 0; i < token_count; i++) {
sum += scoreObject(tokens[i], data);
}
return sum / token_count;
};

if (search.options.conjunction === 'and') {
return function(data) {
var score;
for (var i = 0, sum = 0; i < token_count; i++) {
score = scoreObject(tokens[i], data);
if (score <= 0) return 0;
sum += score;
}
return sum / token_count;
};
} else {
return function(data) {
for (var i = 0, sum = 0; i < token_count; i++) {
sum += scoreObject(tokens[i], data);
}
return sum / token_count;
};
}
};

/**
Expand Down
2 changes: 1 addition & 1 deletion sifter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b61431e

Please sign in to comment.