prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [DOCS] Page wise display of documentation search 
  **Is your feature request related to a problem?**
  Yes. I searched for a relatively simple query in the documentation search bar of https://docs.bokeh.org, and it took very long to load the results. In my second try, the results weren't even loading, I'm afraid. These are displayed in an unordered list which fills the entire page up. It might get frustrating to read through everything to find the answer to the input query.   
  
  **Describe the solution you'd like**
  I would suggest displaying the fetched results in a page wise format, the way most search engines do it. Relevance weighted sorted answer, shown page wise. Fill up only the current page of about 20 to 30 odd query results, and depending on whether the user wants to see the other pages, load them.
  
  **Describe alternatives you've considered**
  If not a page wise result, a folder wise result would also benefit, which leaves the option to the user to navigate where he/she wants to. A custom google search may also help.
  
  **Additional context**
  ![issue](https://user-images.githubusercontent.com/43414361/82223644-88c83400-9940-11ea-9534-f96dc4ae3a6d.PNG)
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `sphinx/docserver.py`
  Content:
  ```
  1 import os
  2 import sys
  3 import threading
  4 import time
  5 import webbrowser
  6 
  7 import flask
  8 import tornado
  9 from tornado.httpserver import HTTPServer
  10 from tornado.ioloop import IOLoop
  11 from tornado.wsgi import WSGIContainer
  12 
  13 _basedir = os.path.join("..", os.path.dirname(__file__))
  14 
  15 app = flask.Flask(__name__, static_folder="/unused")
  16 PORT=5009
  17 http_server = HTTPServer(WSGIContainer(app))
  18 
  19 @app.route('/')
  20 def welcome():
  21     return """
  22     <h1>Welcome to the Bokeh documentation server</h1>
  23     You probably want to go to <a href="/en/latest/index.html"> Index</a>
  24     """
  25 
  26 @app.route('/versions.json')
  27 def send_versions():
  28     return flask.send_from_directory(
  29         os.path.join(_basedir, "sphinx"), "test_versions.json")
  30 
  31 @app.route('/alert.html')
  32 def send_alert():
  33     return os.environ.get("BOKEH_DOCS_ALERT", "")
  34 
  35 @app.route('/en/latest/<path:filename>')
  36 def send_docs(filename):
  37     return flask.send_from_directory(
  38         os.path.join(_basedir, "sphinx/build/html/"), filename)
  39 
  40 def open_browser():
  41     # Child process
  42     time.sleep(0.5)
  43     webbrowser.open("http://localhost:%d/en/latest/index.html" % PORT, new="tab")
  44 
  45 data = {}
  46 
  47 def serve_http():
  48     data['ioloop'] = IOLoop()
  49     http_server.listen(PORT)
  50     IOLoop.current().start()
  51 
  52 def shutdown_server():
  53     ioloop = data['ioloop']
  54     ioloop.add_callback(ioloop.stop)
  55     print("Asked Server to shut down.")
  56 
  57 def ui():
  58     try:
  59         time.sleep(0.5)
  60         input("Press <ENTER> to exit...\n")  # lgtm [py/use-of-input]
  61     except KeyboardInterrupt:
  62         pass
  63 
  64 if __name__ == "__main__":
  65 
  66     if tornado.version_info[0] == 4:
  67         print('docserver.py script requires tornado 5 or higher')
  68         sys.exit(1)
  69 
  70     print("\nStarting Bokeh plot server on port %d..." % PORT)
  71     print("Visit http://localhost:%d/en/latest/index.html to see plots\n" % PORT)
  72 
  73     t_server = threading.Thread(target=serve_http)
  74     t_server.start()
  75     t_browser = threading.Thread(target=open_browser)
  76     t_browser.start()
  77 
  78     ui()
  79 
  80     shutdown_server()
  81     t_server.join()
  82     t_browser.join()
  83     print("Server shut down.")
  84
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/sphinx/docserver.py b/sphinx/docserver.py
  --- a/sphinx/docserver.py
  +++ b/sphinx/docserver.py
  @@ -1,3 +1,4 @@
  +import asyncio
   import os
   import sys
   import threading
  @@ -10,6 +11,11 @@
   from tornado.ioloop import IOLoop
   from tornado.wsgi import WSGIContainer
   
  +# Needed for Windows + Python 3.8 config
  +if sys.version_info.major==3 and sys.version_info.minor >= 8 and sys.platform.startswith('win'):
  +    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
  +
  +
   _basedir = os.path.join("..", os.path.dirname(__file__))
   
   app = flask.Flask(__name__, static_folder="/unused")
  
verification_info: {"golden_diff": "diff --git a/sphinx/docserver.py b/sphinx/docserver.py\n--- a/sphinx/docserver.py\n+++ b/sphinx/docserver.py\n@@ -1,3 +1,4 @@\n+import asyncio\n import os\n import sys\n import threading\n@@ -10,6 +11,11 @@\n from tornado.ioloop import IOLoop\n from tornado.wsgi import WSGIContainer\n \n+# Needed for Windows + Python 3.8 config\n+if sys.version_info.major==3 and sys.version_info.minor >= 8 and sys.platform.startswith('win'):\n+    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\n+\n+\n _basedir = os.path.join(\"..\", os.path.dirname(__file__))\n \n app = flask.Flask(__name__, static_folder=\"/unused\")\n", "issue": "[DOCS] Page wise display of documentation search \n**Is your feature request related to a problem?**\r\nYes. I searched for a relatively simple query in the documentation search bar of https://docs.bokeh.org, and it took very long to load the results. In my second try, the results weren't even loading, I'm afraid. These are displayed in an unordered list which fills the entire page up. It might get frustrating to read through everything to find the answer to the input query.   \r\n\r\n**Describe the solution you'd like**\r\nI would suggest displaying the fetched results in a page wise format, the way most search engines do it. Relevance weighted sorted answer, shown page wise. Fill up only the current page of about 20 to 30 odd query results, and depending on whether the user wants to see the other pages, load them.\r\n\r\n**Describe alternatives you've considered**\r\nIf not a page wise result, a folder wise result would also benefit, which leaves the option to the user to navigate where he/she wants to. A custom google search may also help.\r\n\r\n**Additional context**\r\n![issue](https://user-images.githubusercontent.com/43414361/82223644-88c83400-9940-11ea-9534-f96dc4ae3a6d.PNG)\r\n\r\n\n", "before_files": [{"content": "import os\nimport sys\nimport threading\nimport time\nimport webbrowser\n\nimport flask\nimport tornado\nfrom tornado.httpserver import HTTPServer\nfrom tornado.ioloop import IOLoop\nfrom tornado.wsgi import WSGIContainer\n\n_basedir = os.path.join(\"..\", os.path.dirname(__file__))\n\napp = flask.Flask(__name__, static_folder=\"/unused\")\nPORT=5009\nhttp_server = HTTPServer(WSGIContainer(app))\n\n@app.route('/')\ndef welcome():\n    return \"\"\"\n    <h1>Welcome to the Bokeh documentation server</h1>\n    You probably want to go to <a href=\"/en/latest/index.html\"> Index</a>\n    \"\"\"\n\n@app.route('/versions.json')\ndef send_versions():\n    return flask.send_from_directory(\n        os.path.join(_basedir, \"sphinx\"), \"test_versions.json\")\n\n@app.route('/alert.html')\ndef send_alert():\n    return os.environ.get(\"BOKEH_DOCS_ALERT\", \"\")\n\n@app.route('/en/latest/<path:filename>')\ndef send_docs(filename):\n    return flask.send_from_directory(\n        os.path.join(_basedir, \"sphinx/build/html/\"), filename)\n\ndef open_browser():\n    # Child process\n    time.sleep(0.5)\n    webbrowser.open(\"http://localhost:%d/en/latest/index.html\" % PORT, new=\"tab\")\n\ndata = {}\n\ndef serve_http():\n    data['ioloop'] = IOLoop()\n    http_server.listen(PORT)\n    IOLoop.current().start()\n\ndef shutdown_server():\n    ioloop = data['ioloop']\n    ioloop.add_callback(ioloop.stop)\n    print(\"Asked Server to shut down.\")\n\ndef ui():\n    try:\n        time.sleep(0.5)\n        input(\"Press <ENTER> to exit...\\n\")  # lgtm [py/use-of-input]\n    except KeyboardInterrupt:\n        pass\n\nif __name__ == \"__main__\":\n\n    if tornado.version_info[0] == 4:\n        print('docserver.py script requires tornado 5 or higher')\n        sys.exit(1)\n\n    print(\"\\nStarting Bokeh plot server on port %d...\" % PORT)\n    print(\"Visit http://localhost:%d/en/latest/index.html to see plots\\n\" % PORT)\n\n    t_server = threading.Thread(target=serve_http)\n    t_server.start()\n    t_browser = threading.Thread(target=open_browser)\n    t_browser.start()\n\n    ui()\n\n    shutdown_server()\n    t_server.join()\n    t_browser.join()\n    print(\"Server shut down.\")\n", "path": "sphinx/docserver.py"}], "after_files": [{"content": "import asyncio\nimport os\nimport sys\nimport threading\nimport time\nimport webbrowser\n\nimport flask\nimport tornado\nfrom tornado.httpserver import HTTPServer\nfrom tornado.ioloop import IOLoop\nfrom tornado.wsgi import WSGIContainer\n\n# Needed for Windows + Python 3.8 config\nif sys.version_info.major==3 and sys.version_info.minor >= 8 and sys.platform.startswith('win'):\n    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\n\n\n_basedir = os.path.join(\"..\", os.path.dirname(__file__))\n\napp = flask.Flask(__name__, static_folder=\"/unused\")\nPORT=5009\nhttp_server = HTTPServer(WSGIContainer(app))\n\n@app.route('/')\ndef welcome():\n    return \"\"\"\n    <h1>Welcome to the Bokeh documentation server</h1>\n    You probably want to go to <a href=\"/en/latest/index.html\"> Index</a>\n    \"\"\"\n\n@app.route('/versions.json')\ndef send_versions():\n    return flask.send_from_directory(\n        os.path.join(_basedir, \"sphinx\"), \"test_versions.json\")\n\n@app.route('/alert.html')\ndef send_alert():\n    return os.environ.get(\"BOKEH_DOCS_ALERT\", \"\")\n\n@app.route('/en/latest/<path:filename>')\ndef send_docs(filename):\n    return flask.send_from_directory(\n        os.path.join(_basedir, \"sphinx/build/html/\"), filename)\n\ndef open_browser():\n    # Child process\n    time.sleep(0.5)\n    webbrowser.open(\"http://localhost:%d/en/latest/index.html\" % PORT, new=\"tab\")\n\ndata = {}\n\ndef serve_http():\n    data['ioloop'] = IOLoop()\n    http_server.listen(PORT)\n    IOLoop.current().start()\n\ndef shutdown_server():\n    ioloop = data['ioloop']\n    ioloop.add_callback(ioloop.stop)\n    print(\"Asked Server to shut down.\")\n\ndef ui():\n    try:\n        time.sleep(0.5)\n        input(\"Press <ENTER> to exit...\\n\")  # lgtm [py/use-of-input]\n    except KeyboardInterrupt:\n        pass\n\nif __name__ == \"__main__\":\n\n    if tornado.version_info[0] == 4:\n        print('docserver.py script requires tornado 5 or higher')\n        sys.exit(1)\n\n    print(\"\\nStarting Bokeh plot server on port %d...\" % PORT)\n    print(\"Visit http://localhost:%d/en/latest/index.html to see plots\\n\" % PORT)\n\n    t_server = threading.Thread(target=serve_http)\n    t_server.start()\n    t_browser = threading.Thread(target=open_browser)\n    t_browser.start()\n\n    ui()\n\n    shutdown_server()\n    t_server.join()\n    t_browser.join()\n    print(\"Server shut down.\")\n", "path": "sphinx/docserver.py"}]}