Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the search engine used in the new Python documentation?

Is it built-in in Sphinx?

like image 907
guillermooo Avatar asked Mar 03 '09 10:03

guillermooo


People also ask

Which is the best documentation for Python?

Sphinx. Sphinx is far and away the most popular Python documentation tool. Use it. It converts reStructuredText markup language into a range of output formats including HTML, LaTeX (for printable PDF versions), manual pages, and plain text.

What is Whoosh search?

Whoosh is a fast, featureful full-text indexing and searching library implemented in pure Python. Programmers can use it to easily add search functionality to their applications and websites.

How do you make a search engine in Python?

Create a file urls.py in the engine folder. Append the following lines. Our project is now done , to fire it up type python3 manage.py runserver enter this url in your browser and you should see this. Now enter your query in the search bar and your should get your results like this.


2 Answers

It look like Sphinx contains own search engine for English language. See http://sphinx.pocoo.org/_static/searchtools.js and searchindex.js/.json (see Sphinx docs index 36Kb, Python docs index 857Kb, and Grok docs 37Kb).

Index is being precomputed when docs are generated.

When one searches, static page is being loaded and then _static/searchtools.js extract search terms from query string, normalizes (case, stemming, etc.) them and looks up in searchindex.js as it is being loaded.

First search attempt takes rather long time, consecutive are much faster as index is cached in your browser.

like image 172
myroslav Avatar answered Sep 28 '22 03:09

myroslav


The Sphinx search engine is built in Javascript. It uses JQuery and a (sometimes very big) javascript file containing the search terms.

like image 39
Oli Avatar answered Sep 28 '22 01:09

Oli