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

Fail to initialize searching index for languages other than 'en' #1854

Closed
4 tasks done
peaceiris opened this issue Aug 4, 2020 · 10 comments
Closed
4 tasks done

Fail to initialize searching index for languages other than 'en' #1854

peaceiris opened this issue Aug 4, 2020 · 10 comments
Labels
bug Issue reports a bug

Comments

@peaceiris
Copy link
Contributor

I checked that...

  • ... the documentation does not mention anything about my problem
  • ... the problem doesn't occur with the default MkDocs template
  • ... the problem is not in any of my customizations (CSS, JS, template)
  • ... there are no open or closed issues that are related to my problem

Description

Version 5.5.1 and 5.5.2 fails to initialize search index with Japanese search mode but version 5.5.0 works well.

Expected behavior

5.5.0 works well.

git clone https://github.com/SI-Aizu/documentation.git
cd ./documentation
git checkout cd36072
docker-compose up

Open http://0.0.0.0:8888/, search with a Japanese word or an English word, it works well.

$ docker-compose run --rm --entrypoint=bash mkdocs
$ python --version
Python 3.8.5
$ mkdocs --version
mkdocs, version 1.1.2 from /usr/local/lib/python3.8/site-packages/mkdocs (Python 3.8)
$ pip show mkdocs-material | grep -E ^Version
Version: 5.5.0

Actual behavior

In 5.5.1 and 5.5.2, it shows only the message Initializing search and I cannot search with any word (any language). My browser console (Google Chrome) put the following error.

git clone https://github.com/SI-Aizu/documentation.git
cd ./documentation
git checkout a654e3b
docker-compose up

Screen Shot 2020-08-04 at 17 33 13

Uncaught TypeError: Cannot set property 'stemmerSupport' of undefined    index.ts:63
    at lunr.stemmer.support.min.js:1
    at lunr.stemmer.support.min.js:1
    at lunr.stemmer.support.min.js:1
    at index.ts:63
    at a (index.ts:85)
    at index.ts:109

Screen Shot 2020-08-04 at 17 20 11

$ docker-compose run --rm --entrypoint=bash mkdocs
$ python --version
Python 3.8.5
$ mkdocs --version
mkdocs, version 1.1.2 from /usr/local/lib/python3.8/site-packages/mkdocs (Python 3.8)
$ pip show mkdocs-material | grep -E ^Version
Version: 5.5.1

Steps to reproduce the bug

I already wrote about this above.

Package versions

I already wrote about this above.

Project configuration

I am using the same configuration between the 3 versions.

# Project information
site_name: 'SI-Aizu Documentation'
site_description: 'SI-Aizu Documentation'
site_author: 'SI-Aizu'
site_url: 'https://si-aizu.github.io/documentation'

# Copyright
copyright: '© 2020 SI-Aizu'

# Repository
repo_name: 'GitHub'
repo_url: 'https://github.com/SI-Aizu/documentation'
edit_uri: 'https://github.com/SI-Aizu/documentation/edit/main/docs'

# Configuration
docs_dir: 'docs'
theme:
  name: 'material'
  language: 'ja'
  shortcuts:
    help: 191    # ?
    next: 78     # n
    previous: 80 # p
    search: 83   # s
  palette:
    primary: indigo
    accent: orange
  # features:
  #   - tabs
  #font:
    #text: 'Ubuntu'
    #code: 'Ubuntu Mono'
  #icon:
    #logo: 'images/logo.svg'
  #favicon: 'assets/images/favicon.ico'

# Extensions
markdown_extensions:
  - admonition
  - codehilite
  - footnotes
  - mdx_math:
      enable_dollar_delimiter: true
  - toc:
      permalink: true
      separator: '_'

plugins:
  - search:
      separator: '[\s\-\.]+'
      lang:
        - ja

# Customization
extra_javascript:
  - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-MML-AM_CHTML'
extra_css:
  - 'assets/css/custom.css'
extra:
  # manifest: 'manifest.json'
  social:
    - icon: 'fontawesome/brands/github-alt'
      link: 'https://github.com/SI-Aizu/documentation'

System information

  • OS: macOS Mojave 10.14.6
  • Browser:
    • Google Chrome Version 84.0.4147.105 (Official Build) (64-bit)
    • Microsoft Edge Version 84.0.522.52 (Official build) (64-bit)
@squidfunk squidfunk added the bug Issue reports a bug label Aug 4, 2020
@squidfunk squidfunk changed the title Fail to initialize searching index with Japanese search mode in 5.5.1 and 5.5.2 Fail to initialize searching index for languages other than 'en' Aug 4, 2020
@squidfunk
Copy link
Owner

Thanks for reporting - it's actually related to all other languages, I'll look into it asap.

@squidfunk
Copy link
Owner

Fixed in 1341200.

The problem was related to a change in bundling. With 5.5.1, we switched from expose-loader to the ProvidePlugin, which is generally a more natural fit, as we only want to prepend lunr to the search worker output. The problem is, that the minifier will now eradicate the global.lunr assignment, removing it from the global scope, which triggered a cascade of errors.

The referenced commit switches back to expose-loader (which was updated to 1.0.0).

@squidfunk
Copy link
Owner

Released as part of 5.5.3.

@peaceiris
Copy link
Contributor Author

This was fixed in 5.5.3! Thank you for the quick fix.

@ryo1988
Copy link

ryo1988 commented Sep 29, 2020

In 6.0.1, if you specify 'ja', it remains "Initializing search".

@squidfunk
Copy link
Owner

squidfunk commented Sep 29, 2020

I can't reproduce this, Japanese search works on a clean installation for me:

screenshot-0-0-0-0-8000-1601361624363

Contents of mkdocs.yml:

site_name: My Docs
theme:
  name: material
  language: ja

@ryo1988
Copy link

ryo1988 commented Sep 29, 2020

Thanks for the confirmation.
I have created a reproduction environment.

https://github.com/ryo1988/mkdocsTest

Clone it and Run it.

  • Run.4.6.3.bat OK
    image

  • Run.6.0.1.bat NG
    image

ENVIRONMENT:

@squidfunk
Copy link
Owner

Thanks for providing the reproduction. However, it's exactly the same as the one I posted in my last comment and I'm yet unable to reproduce the error you're seeing.

@ryo1988
Copy link

ryo1988 commented Sep 29, 2020

When I tried 5.0.0, it was not successful.
I changed the "HKEY_CLASSES_ROOT.js\Content Type" in the registry from "text/plain" to "text/javascript" and it became OK.
Do I have to set the "HKEY_CLASSES_ROOT.js\Content Type" in the registry to "text/javascript"?

@TACO-Chloe
Copy link

TACO-Chloe commented Jan 22, 2021

Fail to initialize searching on mobile.
Than web can search anything ..

version :
mkdocs 1.1.2
mkdocs-material 6.2.4

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

No branches or pull requests

4 participants