krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.1k stars 766 forks source link

Search for a word in text is not working #272

Closed santosh-1987 closed 4 years ago

santosh-1987 commented 5 years ago

Hi Team,

Currently, I am trying to search an exact match within a string but it is not working as expected

Sample data:

[
     {
        title: "Old Man's War",
        author: {
          firstName: "John",
          lastName: "Scalzi"
        }
     },
     {
        title: "navigation_test_search",
        author: {
          firstName: "Steve",
          lastName: "Hamilton"
        }
     },
     {
        title: "HTML5",
        author: {
          firstName: "test_navigation_search",
          lastName: "Sharp"
        }
     },
     {
        title: "Right Ho Jeeves",
        author: {
          firstName: "P.D",
          lastName: "Woodhouse"
        }
     },
     {
        title: "The Code of the Wooster",
        author: {
          firstName: "P.D",
          lastName: "Woodhouse"
        }
     },
     {
        title: "Thank You Jeeves",
        author: {
          firstName: "search_test_navigation",
          lastName: "Woodhouse"
        }
     },
     {
        title: "search_test_navigation_schema",
        author: {
          firstName: "Dan",
          lastName: "Brown"
        }
     },
     {
        title: "Angels & Demons",
        author: {
          firstName: "Dan",
          lastName: "Brown"
        }
     },
     {
        title: "The Silmarillion",
        author: {
          firstName: "J.R.R",
          lastName: "Tolkien"
        }
     },
     {
        title: "search_test_navigation_second",
        author: {
          firstName: "Max",
          lastName: "Barry"
        }
     },
     {
        title: "The Lost Symbol",
        author: {
          firstName: "Dan",
          lastName: "search_test_navigation_second_field"
        }
     },
     {
        title: "The Book of Lies",
        author: {
          firstName: "Brad",
          lastName: "Meltzer"
        }
     },
     {
        title: "Lamb",
        author: {
          firstName: "Christopher",
          lastName: "Moore"
        }
     },
     {
        title: "Fool",
        author: {
          firstName: "Christopher",
          lastName: "Moore"
        }
     },
     {
        title: "Incompetence",
        author: {
          firstName: "Rob",
          lastName: "Grant"
        }
     },
     {
        title: "Fat",
        author: {
          firstName: "Rob",
          lastName: "Grant"
        }
     },
     {
        title: "Colony",
        author: {
          firstName: "Rob",
          lastName: "Grant"
        }
     },
     {
        title: "Backwards, Red Dwarf",
        author: {
          firstName: "Rob",
          lastName: "Grant"
        }
     },
     {
        title: "The Grand Design",
        author: {
          firstName: "Stephen",
          lastName: "Hawking"
        }
     },
     {
        title: "The Book of Samson",
        author: {
          firstName: "David",
          lastName: "Maine"
        }
     },
     {
        title: "The Preservationist",
        author: {
          firstName: "David",
          lastName: "Maine"
        }
     },
     {
        title: "Fallen",
        author: {
          firstName: "David",
          lastName: "Maine"
        }
     },
     {
        title: "Monster 1959",
        author: {
          firstName: "David",
          lastName: "Maine"
        }
     }
  ]

I want to search using keyword navigation where it should return me 6 result set .

How do I acheive it.

krisk commented 5 years ago

.. but it is not working as expected

Could you clarify that? What is the result you're seeing?

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days