Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching for "this" returns arbitrary results #1

Closed
bruchmann opened this issue Jul 9, 2017 · 2 comments
Closed

Searching for "this" returns arbitrary results #1

bruchmann opened this issue Jul 9, 2017 · 2 comments
Assignees
Labels

Comments

@bruchmann
Copy link

Hello @kingpixil

Here’s a simplified test case that hopefully clarifies the issue:

const wade = require("wade");

const data = ["George", "John", "Ringo", "Paul"];
const search = wade(data);

const results = search("this").map(({ index }) => data[index]);
console.log(results); //  ["george", "john", "ringo", "paul"]

Expected behaviour
search("this") returns an empty array and does not mutate the data array.

Actual behaviour
search("this") returns a mutated version of the data array.

Platforms:

  • Windows 10
  • node 8.1.3
  • Chrome 56.0.2924.87
@kbrsh
Copy link
Owner

kbrsh commented Jul 9, 2017

Ahh, the problem here is that the data is being run through Wade's preprocessor, making all letters lowercase, removing punctuation, and removing stop words. This is the same process done for search queries (causing the query to be empty, resulting in all items being returned).

Right now the expected behavior is that the data is preprocessed and the array is mutated, although I guess this isn't the best behavior. I'm working on a new version now.

@kbrsh kbrsh self-assigned this Jul 9, 2017
@kbrsh kbrsh added the bug label Jul 9, 2017
@kbrsh kbrsh closed this as completed in f2afe63 Jul 9, 2017
@kbrsh
Copy link
Owner

kbrsh commented Jul 9, 2017

Fixed in v0.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants