Skip to content

Sugestion results aren't shown #105

Open

Description

@rulka

Hi,

I have problem with this https://jsfiddle.net/gguhuu33/ code.
If I type "siemens s" results are shown. But if I type "siemens sx" no results found.
Can someone tell me where is problem?

Activity

  1. jlbooker commented on Jan 3, 2017

    @jlbooker
    Contributor

    @rulka Interesting. It seems to be a bug, as far as I can tell. Your code looks good to me.

    Odd that it works for some test cases, but not others. For example, a search string of 'Siemens Xel' returns the expected 4 results. However, searching on 'Siemens S' return zero results instead of the expected three ("ST60", "SX1", "SXG75").

    Confirming this a bug for now.

  2. added this to the v1.2.0 milestone on Jan 3, 2017
  3. clamburger commented on Feb 3, 2017

    @clamburger

    I've been experiencing the same issue, and did some debugging: from what I can tell, the issue arises when you return an integer (instead of a string) from the identify function.

    Take a look at this updated fiddle: https://jsfiddle.net/gguhuu33/5/ The only difference is that obj.id is now cast to string in the identify function, and the search works perfectly.

  4. clamburger commented on Feb 3, 2017

    @clamburger

    After some investigating, I've determined that the root cause is that getIntersection sometimes behaves incorrectly if the arrays contain integers.

    Example:

    var a1 = [619, 653, 1003, 1125, 18610];
    var b1 = [619, 1003];
      
    console.log(getIntersection(a1, b1));
    // Expected: [619, 1003]
    // Actual: [1003]
    

    I noticed that somebody has opened a pull request to replace this function (#121), and their changes appear to fix this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions