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

Uncaught TypeError in lunr.js #32

Closed
0thernet opened this issue Sep 18, 2015 · 7 comments
Closed

Uncaught TypeError in lunr.js #32

0thernet opened this issue Sep 18, 2015 · 7 comments
Assignees

Comments

@0thernet
Copy link

This errors pops up when searching regardless of whether "Enable Lunr Pipeline" is on.

Atom Version: 1.0.13
System: Mac OS X 10.10.5
Thrown From: nvatom package, v0.8.1

Stack Trace

Uncaught TypeError: Cannot read property 'tf' of undefined

At /Users/bg/.atom/packages/nvatom/node_modules/docquery/node_modules/lunr/lunr.js:1150

TypeError: Cannot read property 'tf' of undefined
    at [object Object].lunr.Index.documentVector (/Users/bg/.atom/packages/nvatom/node_modules/docquery/node_modules/lunr/lunr.js:1150:53)
    at [object Object].<anonymous> (/Users/bg/.atom/packages/nvatom/node_modules/docquery/node_modules/lunr/lunr.js:1122:61)
    at Array.map (native)
    at [object Object].lunr.SortedSet.map (/Users/bg/.atom/packages/nvatom/node_modules/docquery/node_modules/lunr/lunr.js:622:24)
    at [object Object].lunr.Index.search (/Users/bg/.atom/packages/nvatom/node_modules/docquery/node_modules/lunr/lunr.js:1121:6)
    at DocQuery.search (/Users/bg/.atom/packages/nvatom/node_modules/docquery/lib/DocQuery.js:119:31)
    at NotationalVelocityView.module.exports.NotationalVelocityView.filter (/Users/bg/.atom/packages/nvatom/lib/notational-velocity-view.coffee:66:22)
    at NotationalVelocityView.module.exports.NotationalVelocityView.populateList (/Users/bg/.atom/packages/nvatom/lib/notational-velocity-view.coffee:141:22)
    at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:350:26

Commands

     -0:01.0 nvatom:toggle (atom-text-editor.editor.is-focused.vim-mode.normal-mode)

Config

{
  "core": {
    "audioBeep": false,
    "projectHome": "/Users/bg/temp",
    "themes": [
      "one-dark-ui",
      "base16-tomorrow-dark-theme"
    ],
    "disabledPackages": [
      "minimap",
      "merge-conflicts",
      "git-blame"
    ]
  },
  "nvatom": {
    "directory": "/Users/bg/Notes",
    "enableLunrPipeline": false
  }
}

Installed Packages

# User
file-icons, v1.6.9
linter-rubocop, v0.3.4
nvatom, v0.8.1
pretty-json, v0.4.1
vim-mode, v0.60.0

# Dev
No dev packages
@seongjaelee
Copy link
Owner

This happens when we have an empty note undeleted (so if you want to avoid this problem right now, remove empty notes). Thanks for reporting it.

@0thernet
Copy link
Author

looks like that worked, thanks!

@seongjaelee seongjaelee reopened this Sep 19, 2015
@seongjaelee
Copy link
Owner

Ah that was a hack to avoid the bug. I'll reopen the issue and fix it in a right way. Thanks!

@seongjaelee
Copy link
Owner

When "Enable Lunr Pipeline" is off, and when the body is empty, the error occurs.

lunr.js.

  this._fields.forEach(function (field) {
    var fieldTokens = this.pipeline.run(lunr.tokenizer(doc[field.name]))
    console.log(fieldTokens); // when body is empty, it gives [""], not [].

    docTokens[field.name] = fieldTokens
    lunr.SortedSet.prototype.add.apply(allDocumentTokens, fieldTokens)
  }, this)

@seongjaelee
Copy link
Owner

olivernn/lunr.js#178

@seongjaelee seongjaelee self-assigned this Sep 26, 2015
@seongjaelee
Copy link
Owner

#44 Duplicated.

seongjaelee added a commit to seongjaelee/docquery that referenced this issue Apr 22, 2016
Lower version is causing nvatom unusable: seongjaelee/nvatom#32
The bug fix is here: olivernn/lunr.js#178
@seongjaelee
Copy link
Owner

jonmagic/docquery#9

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

No branches or pull requests

2 participants