KosmosisDire / obsidian-webpage-export

Export html from single files, canvas pages, or whole vaults. Direct access to the exported HTML files allows you to publish your digital garden anywhere. Focuses on flexibility, features, and style parity.
https://docs.obsidianweb.net/
MIT License
813 stars 69 forks source link

[Bug] [1.9.0-2b]: Search won't work. #505

Open WinnerWind opened 2 weeks ago

WinnerWind commented 2 weeks ago

What happened?

When exporting the website and hosting it on local host using python3 -m http.server (Runs the current directory as an Apache server), I expect the search function to work, or show a window, or give some response. No response is seen, and the search bar just works as a default textbar

Reproduction

  1. Clear Cache and Purge (to be on the safe side)
  2. Export site with default settings
  3. Host site
  4. Search bar exists, so try to type something.
  5. No response

Last Working Version

Unsure

Version

1.9.0-2b

Operating System

Arch Linux x86_64 using X11

Obsidian Version

current v1.6.7 installer v1.6.7

Which browsers can you reproduce this in?

Firefox

Relevant log output

Button won't work. Sorry!

Additional Info

No response

KosmosisDire commented 1 week ago

Thanks, I believe the search should be working in the beta and I am not able to reproduce. Can you check if there is console output on the website itself (in the browser) when you try to use the search?

WinnerWind commented 1 week ago

There seems to be no relevant log output. image I pressed enter even after entering the search and no errors were seen. I scrolled to the bottom just to be safe.

KosmosisDire commented 1 week ago

Huh, very strange. I am not able to reproduce this at all (I even used python to host a local server like you did). Are you able to reproduce this with a basic sandbox vault?

Would it be possible for you to share a zip of your exported vault (the exported site not the vault itself) with me so I can try and figure out what is wrong?

Thanks!

WinnerWind commented 1 week ago

Hi there! I'm not at home right now, but I'll do so when I'm back. I'll try reproducing with a sandbox vault, and sending the exported files.

WinnerWind commented 1 week ago

Hi there! I used BRAT and installed Obsidian Webpage Export via that in a sandbox vault. The search function seems to work there. This is clearly a fault with my vault configuration.

I've already ruled out a few things.

  1. The problem is not with the theme, because even with the theme set to default, the problem persists.
  2. The problem is not with plugin configuration, because I re-installed the plugin and the bug persists
  3. The problem is not with the fact that my website is being hosted off a flash drive, because the bug persists even when the website is moved to the NVME drive.

All in all, I am confused. I am still trying to look for a solution. If you wish to poke around the vault and the files, I have uploaded them here. (My Site.zip is the vault, test.zip is the exported website.) My Site.zip test.zip

WinnerWind commented 1 week ago

Closing this issue. Managed to find the cause, but it's a rather counter intuitive one.

I use Linux, and there was a recent update to the kernel. This broke a lot of my sensitive programs, including the program I used to clean up files. I noticed that that program kept trying to clean up the search index for the website. Well, it works now, sorry for taking up your time!

KosmosisDire commented 1 week ago

No worries! I'm glad you found the cause and it's working now! :)

WinnerWind commented 1 week ago

Well, search just broke again, and no its not the script I mentioned. I guess I'll leave it be, since this IS a beta version. Eventually it might just fix itself.

KosmosisDire commented 1 week ago

So I was able to test this with a site I found which had this error even though I can't reproduce. I believe it is a problem with having an outdated version of mini search (at least in this case). You could try finding the latest minified mini search version and copy paste it into the mini search js script in the site lib folder.

Does it only change after re-exporting?

WinnerWind commented 1 week ago

Hi there! Sorry for the late reply. I'll find the Minisearch you are talking about. You mean this one right?

Does it change after re-exporting? No. The behaviour seems to be inconsistent. Sometimes search works after a full purge then re-export, sometimes it doesn't. I am not sure what is going on.

Edit: Whenever exporting, the plugin always warns me that there is no search index and it will make a new one. Not sure if that's a behaviour of "Clear Cache" which I always do to rexport the entire vault.

KosmosisDire commented 1 week ago

Hi there! Sorry for the late reply. I'll find the Minisearch you are talking about. You mean this one right?

Does it change after re-exporting? No. The behaviour seems to be inconsistent. Sometimes search works after a full purge then re-export, sometimes it doesn't. I am not sure what is going on.

Edit: Whenever exporting, the plugin always warns me that there is no search index and it will make a new one. Not sure if that's a behaviour of "Clear Cache" which I always do to rexport the entire vault.

Yes the missing search index shows up because of the full purge. https://cdn.jsdelivr.net/npm/minisearch@7.1.0/dist/umd/index.min.js This is the minisearch cdn. Try pasting it's content into the minisearch.js file in the site-lib/scripts/minisearch.js file in your export and then reloading your site (making sure to clear the cache)

WinnerWind commented 1 week ago

Hi there! The fixed Minisearch does work. I did not need to reload the cache. I jus tpasted the file, refreshed the site, and for good measure, started the python hosting script again, and it works. image image image

KosmosisDire commented 1 week ago

Yay! Great! I have updated the minisearch version which will be out in the next release

WinnerWind commented 6 days ago

Looking forward to the next release! Thanks for your dedication.