Monday, April 11, 2011

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

Is it built-in in Sphinx?

From stackoverflow
  • Yes. Sphinx is not built-in, however. The search widget is part of sphinx. What context did you mean by "built-in"?

    On the page iteself: http://docs.python.org/about.html

    http://sphinx.pocoo.org/

    guillermooo : I find your answer a wee bit contradictory. ;-) I wonder whether it's part of Sphinx or a separate component.
    S.Lott : Not contradictory. You did not specify a context for "built-in". Built-in to Python? Built-in to Sphinx? Built-in to the OS that hosts the site? Built-in to something else?
    myroslav : S.Lott, question is clear, read it carefully once more, please.
    S.Lott : @myroslav: It is clear to you. It is not clear to me. Sorry. You can claim it's clear again, if you want to, but that doesn't help me. I was confused by the question.
    duffymo : +1 - I agree w/ S. Lott. The question is unclear, and the questions are hardly abusive.
  • The Sphinx search engine is built in Javascript. It uses JQuery and a (sometimes very big) javascript file containing the search terms.

  • 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.

0 comments:

Post a Comment