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

Search Plugin Not Working #1400

Closed
1 task
Ares-X opened this issue Oct 15, 2020 · 29 comments
Closed
1 task

Search Plugin Not Working #1400

Ares-X opened this issue Oct 15, 2020 · 29 comments

Comments

@Ares-X
Copy link

Ares-X commented Oct 15, 2020

Bug Report

Steps to reproduce

fist time open docsify website , search plugin is working correct , after click some page , search-min.js throw error ,and search plugin not working any more , type something to search won't get any thing response

What is current behaviour

when open some page

search.min.js:1 Uncaught TypeError: Cannot read property '/./IOT%E5%AE%89%E5%85%A8/360/360%20Phone%20N6%20Pro%E5%86%85%E6%A0%B8%E6%BC%8F%E6%B4%9E' of null
    at search.min.js:1
    at Array.forEach (<anonymous>)
    at i (search.min.js:1)
    at search.min.js:1
    at o (docsify.min.js:1)
    at o (docsify.min.js:1)
    at B (docsify.min.js:1)
    at r (docsify.min.js:1)
    at docsify.min.js:1
    at docsify.min.js:1

image

type something to search

search.min.js:1 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at c (search.min.js:1)
    at r (search.min.js:1)
    at search.min.js:1

image

What is the expected behaviour

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS:

  • Node.js version:

  • npm/yarn version:

  • Browser version:

  • Docsify version: newest

  • Docsify plugins: search

Please create a reproducible sandbox

Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)

@Koooooo-7
Copy link
Member

Could u make it in Sandbox or ur site where it can be reproduced?
Due to the console err, it seems not clearly.

@Koooooo-7 Koooooo-7 added the wait for information something is not clear, waiting for the author of the issue/pr label Oct 15, 2020
@Ares-X
Copy link
Author

Ares-X commented Oct 15, 2020

here is my website https://ares-x.com/wiki/ password: qaxniubi
open some page and wait a while , search will not working
image

@sy-records
Copy link
Member

Modify the search plugin to search.js. Don't use min so we can check for errors!

Change the path to English and try again. https://ares-x.com/wiki/_sidebar.md

Refer to docsify's sidebar document. https://docsify.js.org/_sidebar.md

@Koooooo-7
Copy link
Member

According to the console information, I doubt that your files of ur site r too much to be stored in the LocalStorage as search.index. 😅
Could you remove the most of contents and hv a test again. Waiting for ur feedback.

@Ares-X
Copy link
Author

Ares-X commented Oct 16, 2020

According to the console information, I doubt that your files of ur site r too much to be stored in the LocalStorage as search.index. 😅
Could you remove the most of contents and hv a test again. Waiting for ur feedback.

maybe that's true , this problem doesn't happened on my mac , seem like only effect windows or mobile device?

@Ares-X
Copy link
Author

Ares-X commented Oct 16, 2020

i delete a lot of contents , then work fine on windows device , so is there any way to solve this problem?

@sy-records
Copy link
Member

sy-records commented Oct 16, 2020

see #1400 (comment)

You can convert the path to English to reduce the occupation.

@Ares-X
Copy link
Author

Ares-X commented Oct 16, 2020

see #1400 (comment)

You can convert the path to English to reduce the occupation.

image
i don't think is chinese path cause this error, i have tried many time on local server ,it doesn't have any problem
i already changed search-min.js to search.js it seems like working correct now

@sy-records
Copy link
Member

I'm just suggesting, otherwise your url would be long.

@sy-records sy-records added question and removed wait for information something is not clear, waiting for the author of the issue/pr labels Oct 16, 2020
@Ares-X
Copy link
Author

Ares-X commented Oct 16, 2020

thanks for help

@Ares-X Ares-X closed this as completed Oct 16, 2020
@Koooooo-7
Copy link
Member

Is the issue still exsit?
I guess we need investigation more about it. Could u reset ur site to make the exception reproduciable? thx in advance.
IIRC,the localstorage size is relatived to the browser, I m not sure what makes the difference on different OS. r they the same browsers which u used on Win and Mac?
AFAIK, We havent a solution about it yet, actully, I guess we havnt thought about such a big content in docsify. 🤫

@Ares-X
Copy link
Author

Ares-X commented Oct 16, 2020

Is the issue still exsit?
I guess we need investigation more about it. Could u reset ur site to make the exception reproduciable? thx in advance.
IIRC,the localstorage size is relatived to the browser, I m not sure what makes the difference on different OS. r they the same browsers which u used on Win and Mac?
AFAIK, We havent a solution about it yet, actully, I guess we havnt thought about such a big content in docsify. 🤫

after i changed search-min.js to search.js this problem seem doesn't exist

i used chrome on my mac and win , macos works fine ,but windows has this problem, and i also told my friend to try it ,use firefox and chrome on his windows device , he also have this problem

here is the old version to reproduce this bug
https://ares-x-github-io-41iddeg6s.vercel.app/wiki/ pass:qaxniubi
use chrome on windows open it , at the first time search won't have problem, click some page and wait a monment , open f12 console and try to search anything ,you will see those error i post before

image

@Koooooo-7
Copy link
Member

after i changed search-min.js to search.js this problem seem doesn't exist

It seems weird. 😅

thx again, we will check it and make sure what happened actually.

cc @anikethsaha PTAL, I think there should have something needs be digged out.

@Ares-X
Copy link
Author

Ares-X commented Oct 16, 2020

by the way , ios device still have this problem after changed to search.js
try here https://ares-x.com/wiki/
device: iphone 6s plus
ios version: 13.7

@anikethsaha
Copy link
Member

after i changed search-min.js to search.js this problem seem doesn't exist

It seems weird. 😅

thx again, we will check it and make sure what happened actually.

cc @anikethsaha PTAL, I think there should have something needs be digged out.

yea....we need to have a look in it.

@Koooooo-7 Koooooo-7 added bug confirmed as a bug enhancement and removed bug confirmed as a bug labels Oct 16, 2020
@Koooooo-7
Copy link
Member

FYI. I increased the localstorage size 10 times larger and got the search.index size ( 5411729 bytes, more than 5M).
image

@anikethsaha
Copy link
Member

weird, from which version this is happening ?

@Koooooo-7
Copy link
Member

weird, from which version this is happening ?

IMHO, I think the problem since we set the search.index in local storage.
As we all know, the browsers have default local storage size (about 5 M), and we stored all the markdown files strings as search.index in local storage.
If the files strings r humongous (more than 5 M), we can't set it in the local storage and cause the search err aboved.

@Ares-X
Copy link
Author

Ares-X commented Oct 18, 2020

weird, from which version this is happening ?

IMHO, I think the problem since we set the search.index in local storage.
As we all know, the browsers have default local storage size (about 5 M), and we stored all the markdown files strings as search.index in local storage.
If the files strings r humongous (more than 5 M), we can't set it in the local storage and cause the search err aboved.

https://github.com/wzpan/hexo-generator-search

Maybe you can refer to this save all markdown file strings to a local xml file

@Anilople
Copy link
Contributor

    window.$docsify = {
      loadSidebar: true,
      ....
    }

when loadSidebar is true, the search work again, and just the content was indexed in side bar's reference.

If the content not in side bar‘s reference, they can't be searched.

So strange.

In my project, record it. https://anilople.github.io/find-spirit/#/

@sy-records
Copy link
Member

@Anilople You mean you can't search there?

image

This one? If so, then it's fixed.

@Anilople
Copy link
Contributor

Anilople commented Nov 19, 2020

@sy-records

Yes.

Let me give more example.

content can't be search

find

find

移动

移动

content can be search

ele

ele

world

world

@sy-records
Copy link
Member

fixed via #1391

@Anilople
Copy link
Contributor

fixed via #1391

My docsify version is 4.11.6

Found that there is no code describe like #1391
in my docsify/lib/plugins/search.js file. So the problem occur.

@sy-records
Copy link
Member

Yes, the official version has not been released yet. You can try to build it yourself.

@mengsanit

This comment has been minimized.

@CircArgs
Copy link

CircArgs commented Nov 14, 2023

@sy-records I noticed you cited a fix, and this issue is still open. I am getting a set of errors that appear extremely similar to those of this issue:

docsify.min.js:1 Docsify plugin error TypeError: Cannot read properties of null (reading '/')
    at VM6904 search.js:347:17

 ... lots more 

VM6904 search.js:208 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at search (VM6904 search.js:208:12)
    at doSearch (VM6904 search.js:402:18)
    at VM6904 search.js:440:49

Loading in the bare search.js and poking around, the error stems from these lines:

    Object.keys(INDEXS).forEach(function (key) {
      data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
    });

INDEXS is null for some reason.

I've tried multiple paths configurations and inspected many of the awesome-docsify sites and can't spot any real differences with my setup here: https://github.com/CircArgs/cppfront

Any help would be greatly appreciated! Thank you

@sy-records
Copy link
Member

@CircArgs I didn't reproduce your question. If you're using GitHub Pages, you should try setting basePath: 'cppfront'

image

If you still have problems you can resubmit a new issue instead of replying here and I will close this.

@CircArgs
Copy link

@sy-records Thanks for trying! I was testing on Brave. It seems it was a permission issue. Worked on Chrome. Thanks again.

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

No branches or pull requests

7 participants