diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d03ac08..fd579ab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features added ### Backward-incompatible changes ### Bug fixes +- Allowed "exact text" searching (the first search option) using just + whitespace. ### Performance enhancements - Removed some unused data from `qurro/tests/`. ### Miscellaneous diff --git a/qurro/support_files/js/feature_computation.js b/qurro/support_files/js/feature_computation.js index 2a89bdbf..a66211a2 100644 --- a/qurro/support_files/js/feature_computation.js +++ b/qurro/support_files/js/feature_computation.js @@ -161,7 +161,7 @@ define(function() { throw new Error("featureMetadataField not found in data"); } else if (searchType !== "text" && searchType !== "rank") { throw new Error('searchType must be either "text" or "rank"'); - } else if (inputText.trim().length === 0) { + } else if (inputText.length === 0) { return []; } diff --git a/qurro/tests/web_tests/tests/test_filter_features.js b/qurro/tests/web_tests/tests/test_filter_features.js index 6e2e3cb6..82d40237 100644 --- a/qurro/tests/web_tests/tests/test_filter_features.js +++ b/qurro/tests/web_tests/tests/test_filter_features.js @@ -154,7 +154,7 @@ define(["feature_computation", "mocha", "chai", "testing_utilities"], function( ); }); - it("Doesn't find anything if inputText is empty or contains only whitespace", function() { + it("Doesn't find anything if inputText is empty, but can do just-text-searching using whitespace", function() { chai.assert.isEmpty( feature_computation.filterFeatures( rpJSON1, @@ -187,6 +187,17 @@ define(["feature_computation", "mocha", "chai", "testing_utilities"], function( "text" ) ); + chai.assert.sameMembers( + testing_utilities.getFeatureIDsFromObjectArray( + feature_computation.filterFeatures( + rpJSON1, + " ", + "Feature ID", + "text" + ) + ), + inputFeatures + ); }); it("Ignores actual null values", function() { // Feature 6's Taxonomy value is "null", while Feature 7's