hoelzro / tw-full-text-search

Full text search plugin for TiddlyWiki powered by lunr.js
https://hoelz.ro/files/fts.html
Other
25 stars 4 forks source link

TypeError #2

Closed diego898 closed 6 years ago

diego898 commented 6 years ago

Hey, I'm not sure what caused this, but now when I try to generate the index, I get the following error in my console:

TypeError: Cannot read property 'Selection Constructors' of undefined
    at e.MutableBuilder.e.Builder.add ($:/plugins/hoelzro/full-text-search/lunr.min.js:7)
    at updateTiddler ($:/plugins/hoelzro/full-text-search/shared-index.js:202)
    at eval ($:/plugins/hoelzro/full-text-search/shared-index.js:99)
    at step ($:/plugins/hoelzro/full-text-search/shared-index.js:39)
    at Object.eval [as next] ($:/plugins/hoelzro/full-text-search/shared-index.js:20)
    at fulfilled ($:/plugins/hoelzro/full-text-search/shared-index.js:11)
    at <anonymous>
hoelzro commented 6 years ago

Yikes! Thanks for the report - are you familiar with the developer console? If so, could you run this chunk of code, reload the page, and try again to see if it helps?

$tw.modules.execute('$:/plugins/hoelzro/full-text-search/localforage.min.js').clear().then(function() { console.log('index cleared') })
diego898 commented 6 years ago

after running that, and refreshing, I was able to generate the index. How could it have gotten corrupted? And should there be a button in the control panel to run that in case it happens again? thanks!

diego898 commented 6 years ago

bump!

hoelzro commented 6 years ago

@diego898 Sorry, this fell off of my radar! I don't know how the index could've gotten corrupted - I can try to look into the stack trace you posted, but since the lunr.js file is minified it probably won't help me figure it out =( I'll make the code more robust in the near future - maybe I'll just have it build the index from scratch if it encounters an error during an incremental update.

hoelzro commented 6 years ago

Note to self: just bundle the unminified lunr.js source for this to help with debugging?

hoelzro commented 6 years ago

Note to self: it must be some [...] field access in lunr.Builder.add?

hoelzro commented 6 years ago

@diego898 BTW, is "Selection Constructors" a title or tag of one of your tiddlers?

hoelzro commented 6 years ago

@diego898 Also, have you seen this problem come up again? Which browser are you using?

diego898 commented 6 years ago

I havent seen it again, on either chrome or firefox. and "Selection constructor" is the name of a tiddler

hoelzro commented 6 years ago

Ok, thanks for the info - that helps a lot!

hoelzro commented 6 years ago

@diego898 Also, was this the first time you tried to generate the index after installing a newer version of the plugin?

diego898 commented 6 years ago

Hm - Im not sure. I dont remember when it popped up. I guess if you cant replicate it we can just close for now and Ill reopen if it pops up again? thanks for looking into it!

hoelzro commented 6 years ago

@diego898 Thanks for reporting and for the information - I have a good idea where it happened, but I'm not really sure why. I'll keep it in the back of my mind - I'm hoping it was just a one-off thing, but I'm really curious what happened!