krisk / Fuse

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

Cannot read property 'split' of null #350

Closed davwheat closed 4 years ago

davwheat commented 4 years ago

I'm trying to add this to my project and I'm encountering an error:

TypeError: Cannot read property 'split' of null

Here are my Fuse options:

const fuseJsOptions = {
  shouldSort: true,
  tokenize: true,
  threshold: 0.6,
  location: 0,
  distance: 300,
  maxPatternLength: 50,
  minMatchCharLength: 1,
  keys: [
    { name: "title", weight: 0.45 },
    { name: "description", weight: 0.35 },
    { name: "content", weight: 0.2 },
  ],
}

...and here is an example of what I am passing into the search function:

[
  {
    "title": "Duncan",
    "description": "A character analysis of Duncan from Shakespeare's play, Macbeth.",
    "content": "He is kind, but too trusting kind, \"let me enfold thee / And hold thee to my heart\". trusting, \"There's no art / To find the mind's construction in the face\". a good king, \"So clear in his great office\". Nobody has a bad word to say about Duncan. Even Macbeth says \"his virtues / Will plead like angels\". Duncan's flaw is that he is too trusting: he describes the man that murders him as \"a gentleman on whom I built / An absolute trust\". However he can be firm (he executed the old Thane of Cawdor for betraying him). He is an example of a good king He is a model king: kind, honest and fair. Macbeth says he is \"a most sainted king,\" reminding the audience that kings were chosen by God (when Macbeth was not). He is a HUGE contrast to when the tyrannous king Macbeth is in power. Duncan puts Scotland's needs ahead of his own. Duncan is loved, Macbeth is feared and hated. Duncan isn't like other men He isn't a soldier like Macbeth or Macduff. He's gentle and doesn't fight for himself, but sensibly sends his best soldiers. He's not afraid to be emotional. He shows \"drops of sorrow\" because he's so happy and talks about his \"gentle senses\" - it could be seen as 'unmanly'. The fact that Duncan is depicted as a model king but not necessarily 'manly', leads the audience to question whether a good leader needs to be a vicious warrior."
  },
  {
    "title": "Lady Macbeth",
    "description": "A character analysis of Lady Macbeth from Shakespeare's play, Macbeth.",
    "content": "She is mentally disturbed Throughout the play, she only speaks in blank verse. However, as the the play goes on this begins to change. \"Out damned spot! Out, I say!\" The lack of blank verse her shows that her mental situation is deteriorating. She is obsessed with nightmares of her actions and finally commits suicide \"Here's the smell of the blood still: all the\nperfumes of Arabia will not sweeten this little hand. Oh, oh, oh!\". She is dominant She is the main instigator of the plot to kill the king. Likes to be treated as an equal, which was frowned upon at the time. Macbeth has succumbed to her, and treats her as a equal, \"my dearest partner of greatness\". Macbeth compliments her on the fact that she uses her strength like a man - \"Bring forth men-children only!\" - showing that she there is nothing 'soft' or feminine about her. She is cunning Gains Duncan's trust \"our honoured hostess\" and \"Fair and noble hostess\". Tells Macbeth to \"Look like the innocent flower, but be the serpent under't\", showing that she will do anything to get her way. She is an agent of the supernatural First she her true intentions in the opening scene, where she calls upon the \"Spirits that tend on mortal thoughts\" to deprive her of her feminine instinct to care. She is determined to make sure that the prophecy is true \"Glamis thou art, and Cawdor; and shalt be / What thou art promised.\" She calls on the spirits just as the witches did \"unsex me here\". She also goes on to ask spirits to take away all her natural feelings, and instead fill her full of \"direst cruelty\". She asks them to stop up the \"passage of remorse\" and to replace her milk with 'gall'. Malcom's final judgement is that Lady Macbeth was like a devil - \"fiend-like queen\". Invokes the powers of evil to help her influence her husband to commit murder and treason. Raises the question about Shakespeare's ideas on the supernatural."
  },
  {
    "title": "The Macduffs",
    "description": "Character analyses of the Macduffs from Shakespeare's play, Macbeth.",
    "content": "Macduff is honest and sincere He is a nobleman. He's honest and has integrity, so he acts as a contrast to Macbeth. He discovers Duncan's murder and is horrified by it. He doesn't go to Macbeth's coronation, suggesting he is suspicious, instead going to Fife. Macduff has a strong sense of loyalty and love for his country. 'O Scotland, Scotland!\" He is brave - he fights and kills Macbeth. But he puts his country before his family He makes a mistake by going to England. He leaves his wife and children unprotected. This decision shows a strong sense of justice but also lack of wisdom. \"All my pretty ones? / Did you say all?\" - overcome with grief when he hears about Macbeth murdering his family. He kills Macbeth to put the rightful heir on the throne and to avenge his family. Lady Macduff cannot understand her husband's actions When he goes to England, she says he lacks \"the natural touch\" - she thinks his behaviour shows a lack of fatherly love. She shows courage as she comforts her son, calling him \"Poor bird\". Her love and affection for him are clear. They speak in prose, which makes the scene feel natural and homely - this makes the murders even more shocking and horrible. The above contrasts to Lady Macbeth who says \"Have plucked my nipple from his boneless gums / And dashed the brains out\" (about killing her own baby)"
  },
  {
    "title": "Macbeth",
    "description": "A character analysis of Macbeth from Shakespeare's play, Macbeth.",
    "content": "He is ambitious but easily led astray He is ambitious: \"I have no spur / To prick the sides of my intent, but only / Vaulting ambition\" He is brave: \"brave Macbeth - well he deserves that name\" He is guilty: \"Will all great Neptune's ocean wash this blood / Clean from my hand?\" The way Macbeth speaks reflects his state of mind. He asks lots of questions when he's feeling uncertain or guilty: \"Whence is that knocking? / How is't with me, when every noise appals me?\". At the start and end of the play he is more certain and confident: \"Stars, hide you fires\", \"I will not yield\". He is a brave hero At the start he is described as a \"valiant\" warrior. Ross compares him to \"Bellona's bridegroom\" - a comparison to the God of War (Mars). He impresses the King and shows his loyalty. Macbeth is most comfortable on the battlefield where he doesn't have to worry about his guilty conscience or morality of his actions. He is a brutal murderer He is a brutal murderer. \"I am settled and bend up / Each corporal agent to this terrible feat\". He kills Duncan, the Macduffs and Banquo. He struggles with his conscience Macbeth struggles with his conscience. He has a strong sense of right and wrong. He worries about the consequences of his actions yet still does many of them which makes them even more shocking to the audience. After he kills Duncan, his guilty conscience makes him imagine things: \"Macbeth does murder sleep\". Then he sees Banquo's ghost at the banquet. By the end of the play he seams world-weary and cynical - he no longer feels guilty because he feels his actions don't matter and that life means \"nothing\". He is easily influenced He is easily influenced: Macbeth does what Lady Macbeth wants because he doesn't want to be seen as a \"coward\" and to be \"more the man\". Links to masculinity, strength and courage themes. He is also influenced by the super-natural. The first time he meets the Witches he trusts them first time, saying \"Two truths are told\". He sees the dagger that leads him to kill Duncan. When the prophecies come true he relies on the witches even more."
  },
  {
    "title": "The 3 Witches",
    "description": "A character analysis of The 3 Witches from Shakespeare's play, Macbeth.",
    "content": "They have supernatural powers The Three Witches are also known as the Weird Sisters. They look unnatural and evil. The Witches can see the future. They seem to act out of malice - they don't gain anything but they just enjoy causing trouble. They speak in short rhyming lines. It sets them apart from other characters. Lines like \"Eye of newt, and toe of frog / Wool of bat, and tongue of dog\" make them sound gruesome and evil. Their line \"Fair is foul, and foul is fair\" shows that nothing is as it seems in the play. They're evil, but they don't tell Macbeth to murder Duncan The Witches are typically accompanied by \"Thunder and lightning\" (pathetic fallacy) making the atmosphere dark and frightening. They make prophecies but don't explain how they take place. This takes advantage of Macbeth's \"Vaulting ambition\", and so they use it to control his actions. They predict he will be king - which pushes him to murder Duncan. They confuse Macbeth using paradoxes - for example telling him Banquo will be \"Lesser than Macbeth, and greater\". By not being clear about what the future holds, they keep control of Macbeth. They trick Macbeth by making predictions that give him a false sense of security, such as \"none of woman born / Shall harm Macbeth\"."
  },
  {
    "title": "Malcolm & Donalbain",
    "description": "Character analyses of Malcolm & Donalbain from Shakespeare's play, Macbeth.",
    "content": "They are Duncan's sons. Malcolm is the eldest, and is therefore heir to the throne after Duncan died. This means that he should be the next King of Scotland, not Macbeth. They learn from their father's mistakes Malcolm is fair and honest, like his father. However, unlike Duncan, Malcolm and Donalbain are aware that they're in danger from those closest to them: \"There's daggers in men's smiles, the near'r in blood / The nearer the bloody\" They have common sense to flee Scotland after Duncan is murdered. Malcolm learns that he should only trust people who have proved their loyalty - when Macduff visits him, Malcolm tests his loyalty by pretending to be a tyrant. He knows that even people who see good can be evil - \"all things foul would wear the brows of grace\". In the end, Malcolm and Macduff make a good partnership because Macduff's experience gives Malcolm the confidence to take action. Malcolm and Donalbain aren't impulsive They don't react instantly to their father's murder. Malcolm says their sorrow is too \"strong\" to act immediately. It shows he's sensible unlike Macbeth. Malcolm develops to be a good leader He becomes confident, and earns the trust of the Scottish thanes, who say they will \"give obedience where 'tis truly owed\". They follow Malcolm because he's the rightful King. He proves he's clever when he returns to Scotland by hiding the soldiers with trees. He leads them to victory, proving he is a strong leader. He rewards everyone who fought with him, like Duncan he's generous."
  },
  {
    "title": "Others",
    "description": "Character analyses of miscellaneous characters from Shakespeare's play, Macbeth.",
    "content": "The other nobleman Lennox, Rose, Menteith, Angus and Caithness are all thanes. They aren't that important but show the power shifts in the play. Lennox sarcastically says that Macbeth \"nobly\" and \"wisely\" killed Duncan's guards. This shows how the thanes suspect that Macbeth killed Duncan. The thanes say that they will \"give obedience where 'tis truly owed\" - they'll be loyal to the rightful king. A few others The Porter in Act 2 is there to relieve some tension between the darker and tragic parts in the play. Three Murderers appear in Act 3. They show how ruthless Macbeth is but also that he is unwilling to commit more murders. They show how desperate and cruel Macbeth is."
  },
  {
    "title": "Banquo",
    "description": "A character analysis of Banquo from Shakespeare's play, Macbeth.",
    "content": "He is more honourable than Macbeth He is a thane, like Macbeth. He is there when the Witches make their prophecies. He is praised for his courage in battle - just like Macbeth. However, while Macbeth is guided by his own selfish desires, Banquo has \"a wisdom that doth guide his valour\". This suggests he thinks before he acts, and does what is right. Banquo isn't corrupted by his own ambition unlike Macbeth (though he is ambitious), so Banquo remains honourable. Macbeth promises to \"honour\" Banquo for his loyalty, but Banquo chooses to keep his \"allegiance clear\" - his conscience is more important to his than power or glory. He doesn't trust the Witches He behaves rationally when meeting them - questioning their existence as he doesn't trust them. In contrast Macbeth is \"rapt withall\" Banquo is aware that the Witches could be \"fantastical\" and is perceptive enough to realise that they are \"instruments of darkness\" that could \"win us to our harm\". He's more cautious about believing what he sees than Macbeth. He doesn't act to protect himself Banquo suspects that Macbeth murdered Duncan - \"I fear / Thou play'dst most foully\". However he doesn't act on his suspicions as he remembers the predictions that he will be the \"father / Of many kings\". This shows that even the most honourable characters are influenced by ambition. Macbeth sees Banquo as a threat - he says there is no one except Banquo \"Whose being I do fear\". When Banquo is assassinated he says \"O, treachery!\", showing that he didn't expect Macbeth to betray him."
  }
]

Full error:

fuse.js:9 Uncaught TypeError: Cannot read property 'split' of null
    at e.value (fuse.js:9)
    at e.value (fuse.js:9)
    at ArticleList (ArticleList.jsx:101)
    at renderWithHooks (react-dom.development.js:16266)
    at mountIndeterminateComponent (react-dom.development.js:18774)
    at beginWork$1 (react-dom.development.js:20136)
    at HTMLUnknownElement.callCallback (react-dom.development.js:337)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:386)
    at invokeGuardedCallback (react-dom.development.js:441)
    at beginWork$$1 (react-dom.development.js:25737)
    at performUnitOfWork (react-dom.development.js:24661)
    at workLoopSync (react-dom.development.js:24637)
    at performSyncWorkOnRoot (react-dom.development.js:24236)
    at scheduleUpdateOnFiber (react-dom.development.js:23664)
    at updateContainer (react-dom.development.js:27060)
    at react-dom.development.js:27484
    at unbatchedUpdates (react-dom.development.js:24399)
    at legacyRenderSubtreeIntoContainer (react-dom.development.js:27483)
    at render (react-dom.development.js:27620)
    at app.js:67
krisk commented 4 years ago

I'm taking the above content, and I cannot reproduce the issue. What's the pattern you're using?

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