From: Dmitry Shachnev <mitya57@debian.org>
Date: Thu, 27 Aug 2020 20:11:16 +0300
Subject: Disable Lunr.py support

It is not packaged in Debian.
---
 docs/user-guide/configuration.md      |  7 -------
 mkdocs/contrib/search/__init__.py     |  2 +-
 mkdocs/contrib/search/search_index.py |  8 --------
 mkdocs/tests/search_tests.py          | 13 -------------
 setup.py                              |  1 -
 5 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md
index 994282c..4a186b5 100644
--- a/docs/user-guide/configuration.md
+++ b/docs/user-guide/configuration.md
@@ -533,11 +533,6 @@ path. If this feature is enabled and fails for any reason, a warning is issued.
 You may use the `--strict` flag when building to cause such a failure to raise
 an error instead.
 
-Using [Lunr.py] setting `prebuild_index` to `python`. Lunr.py is installed
-as part of mkdocs and guarantees compatibility with Lunr.js even on languages
-other than english. If you find substantial inconsistencies or problems please
-report it on [Lunr.py's issues] and fall back to the Node.js version.
-
 !!! Note
 
     On smaller sites, using a pre-built index is not recommended as it creates a
@@ -562,5 +557,3 @@ report it on [Lunr.py's issues] and fall back to the Node.js version.
 [Plugins]: plugins.md
 [lunr.js]: https://lunrjs.com/
 [Node.js]: https://nodejs.org/
-[Lunr.py]: http://lunr.readthedocs.io/
-[Lunr.py's issues]: https://github.com/yeraydiazdiaz/lunr.py/issues
diff --git a/mkdocs/contrib/search/__init__.py b/mkdocs/contrib/search/__init__.py
index a2c7f7c..baef84b 100644
--- a/mkdocs/contrib/search/__init__.py
+++ b/mkdocs/contrib/search/__init__.py
@@ -37,7 +37,7 @@ class SearchPlugin(BasePlugin):
         ('lang', LangOption(default=['en'])),
         ('separator', config_options.Type(str, default=r'[\s\-]+')),
         ('min_search_length', config_options.Type(int, default=3)),
-        ('prebuild_index', config_options.Choice((False, True, 'node', 'python'), default=False)),
+        ('prebuild_index', config_options.Choice((False, True, 'node'), default=False)),
     )
 
     def on_config(self, config, **kwargs):
diff --git a/mkdocs/contrib/search/search_index.py b/mkdocs/contrib/search/search_index.py
index 1aa9fa7..affa65e 100644
--- a/mkdocs/contrib/search/search_index.py
+++ b/mkdocs/contrib/search/search_index.py
@@ -4,8 +4,6 @@ import json
 import logging
 import subprocess
 
-from lunr import lunr
-
 from html.parser import HTMLParser
 
 log = logging.getLogger(__name__)
@@ -118,12 +116,6 @@ class SearchIndex:
                     log.warning('Failed to pre-build search index. Error: {}'.format(err))
             except (OSError, ValueError) as e:
                 log.warning('Failed to pre-build search index. Error: {}'.format(e))
-        elif self.config['prebuild_index'] == 'python':
-            idx = lunr(
-                ref='location', fields=('title', 'text'), documents=self._entries,
-                languages=self.config['lang'])
-            page_dicts['index'] = idx.serialize()
-            data = json.dumps(page_dicts, sort_keys=True, separators=(',', ':'))
 
         return data
 
diff --git a/mkdocs/tests/search_tests.py b/mkdocs/tests/search_tests.py
index fe4ecf0..0de013c 100644
--- a/mkdocs/tests/search_tests.py
+++ b/mkdocs/tests/search_tests.py
@@ -427,19 +427,6 @@ class SearchIndexTests(unittest.TestCase):
         self.assertEqual(mock_popen_obj.communicate.call_count, 0)
         self.assertEqual(result, expected)
 
-    @mock.patch('mkdocs.contrib.search.search_index.lunr', autospec=True)
-    def test_prebuild_index_python(self, mock_lunr):
-        mock_lunr.return_value.serialize.return_value = {'mock': 'index'}
-        index = search_index.SearchIndex(prebuild_index='python', lang='en')
-        expected = {
-            'docs': [],
-            'config': {'prebuild_index': 'python', 'lang': 'en'},
-            'index': {'mock': 'index'}
-        }
-        result = json.loads(index.generate_search_index())
-        self.assertEqual(mock_lunr.call_count, 1)
-        self.assertEqual(result, expected)
-
     @mock.patch('subprocess.Popen', autospec=True)
     def test_prebuild_index_node(self, mock_popen):
         # See https://stackoverflow.com/a/36501078/866026
diff --git a/setup.py b/setup.py
index 2784814..3bf5215 100755
--- a/setup.py
+++ b/setup.py
@@ -57,7 +57,6 @@ setup(
         'click>=3.3',
         'Jinja2>=2.10.1',
         'livereload>=2.5.1',
-        'lunr[languages]==0.5.8',  # must support lunr.js version included in search
         'Markdown>=3.2.1',
         'PyYAML>=3.10',
         'tornado>=5.0'
