typescript-book icon indicating copy to clipboard operation
typescript-book copied to clipboard

Search function broken?

Open estaub opened this issue 9 years ago • 8 comments

If I try to search the doc online, using the search in the upper left corner, it fails with stack trace:

Uncaught TypeError: Cannot read property 'tf' of undefined
    at t.Index.documentVector (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-lunr/lunr.min.js:7:8688)
    at t.Index.<anonymous> (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-lunr/lunr.min.js:7:8449)
    at Array.map (native)
    at t.SortedSet.map (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-lunr/lunr.min.js:7:4292)
    at t.Index.search (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-lunr/lunr.min.js:7:8396)
    at LunrSearchEngine.search (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-lunr/search-lunr.js:34:40)
    at Object.query (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-search/search-engine.js:31:23)
    at launchSearch (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-search/search.js:79:33)
    at handleUpdate (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-search/search.js:121:17)
    at HTMLInputElement.<anonymous> (https://basarat.gitbooks.io/typescript/content/gitbook/gitbook-plugin-search/search.js:142:13)
t.Index.documentVector @ lunr.min.js:7
(anonymous) @ lunr.min.js:7
t.SortedSet.map @ lunr.min.js:7
t.Index.search @ lunr.min.js:7
LunrSearchEngine.search @ search-lunr.js:34
query @ search-engine.js:31
launchSearch @ search.js:79
handleUpdate @ search.js:121
(anonymous) @ search.js:142
dispatch @ gitbook.js:2
m.handle @ gitbook.js:2

estaub avatar Apr 09 '17 02:04 estaub

https://twitter.com/basarat/status/852021412596334592

/cc @gitbookio :rose:

basarat avatar Apr 12 '17 04:04 basarat

Thanks. But leaving open till its fixed by gitbook :rose:

basarat avatar Apr 13 '17 00:04 basarat

I'm still experiencing this issue on the deployed version of the site - same error in the console

dylanscott avatar May 26 '17 17:05 dylanscott

Still broken. A weak, perhaps obvious workaround is to google for

site:https://basarat.gitbooks.io <your-search-terms>

and then search within the page using your browser "find".

estaub avatar Jul 29 '17 15:07 estaub

I tried without success to find an issue on https://github.com/GitbookIO/plugin-search, https://github.com/GitbookIO/plugin-lunr, or https://github.com/GitbookIO/gitbook that relates to this. @basarat, Are you sure this isn't a book-specific problem? Might it make sense to submit an issue (probably on https://github.com/GitbookIO/plugin-lunr)?

(I know nothing about GitBook, beyond what I dug up for this comment.)

estaub avatar Jul 29 '17 15:07 estaub

I've made my config https://github.com/basarat/typescript-book/blob/master/book.json same as mobx https://github.com/mobxjs/mobx/blob/gh-pages/docs/book.json But its still not working :( So definitely not an issue with with our config

basarat avatar Jul 31 '17 00:07 basarat

Adding this to book.json fixed the problem. I think it was happening because of some emojis I used in my book.

{
    "pluginsConfig": {
        "lunr": {
            "ignoreSpecialCharacters": true
        }
    }
}

I also reported this here: https://github.com/GitbookIO/plugin-lunr/issues/3

pitasi avatar Sep 10 '17 15:09 pitasi

@Pitasi that fixed it. Thank you soo much! :rose:

basarat avatar Sep 11 '17 01:09 basarat