ó ˙gdSc@sGdZddlZdefd„ƒYZidd6dd 6dd 6ZdS(sę sphinx.websupport.search ~~~~~~~~~~~~~~~~~~~~~~~~ Server side search support for the web support package. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. i˙˙˙˙Nt BaseSearchcBs_eZd„Zgd„Zd„Zd„Zd„Zd„Zd„Zdd„Z d „Z RS( cCsdS(N((tselftpath((sK/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyt__init__scCsdS(sCalled by the builder to initialize the search indexer. `changed` is a list of pagenames that will be reindexed. You may want to remove these from the search index before indexing begins. :param changed: a list of pagenames that will be re-indexed N((Rtchanged((sK/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyt init_indexingscCsdS(sŁCalled by the builder when writing has been completed. Use this to perform any finalization or cleanup actions after indexing is complete. N((R((sK/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pytfinish_indexingscCs|j|||jƒƒdS(sÖCalled by the builder to add a doctree to the index. Converts the `doctree` to text and passes it to :meth:`add_document`. You probably won't want to override this unless you need access to the `doctree`. Override :meth:`add_document` instead. :param pagename: the name of the page to be indexed :param title: the title of the page to be indexed :param doctree: is the docutils doctree representation of the page N(t add_documenttastext(Rtpagenamettitletdoctree((sK/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pytfeed#s cCs tƒ‚dS(s­Called by :meth:`feed` to add a document to the search index. This method should should do everything necessary to add a single document to the search index. `pagename` is name of the page being indexed. It is the combination of the source files relative path and filename, minus the extension. For example, if the source file is "ext/builders.rst", the `pagename` would be "ext/builders". This will need to be returned with search results when processing a query. :param pagename: the name of the page being indexed :param title: the page's title :param text: the full text of the page N(tNotImplementedError(RR R ttext((sK/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyR/scCs4tjdj|jƒƒtjƒ|_|j|ƒS(s§Called by the web support api to get search results. This method compiles the regular expression to be used when :meth:`extracting context `, then calls :meth:`handle_query`. You won't want to override this unless you don't want to use the included :meth:`extract_context` method. Override :meth:`handle_query` instead. :param q: the search query string. t|(tretcompiletjointsplittIt context_ret handle_query(Rtq((sK/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pytqueryAs 'cCs tƒ‚dS(s6Called by :meth:`query` to retrieve search results for a search query `q`. This should return an iterable containing tuples of the following format:: (, , <context>) `path` and `title` are the same values that were passed to :meth:`add_document`, and `context` should be a short text snippet of the text surrounding the search query in the document. The :meth:`extract_context` method is provided as a simple way to create the `context`. :param q: the search query N(���R ���(���R���R���(����(����sK���/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyR���M���s����iđ���c���������C���sĹ���|��j��j�|�ƒ�}�|�d�k�r"�d�St�|�j�ƒ��t�|�d�ƒ�d�ƒ�}�|�|�}�d�j�|�d�k�rg�d�pj�d�|�|�|�!|�t�|�ƒ�k��rŒ�d�p�d�g�ƒ�}�y�t�|�d�d�ƒSWn�t �k �rŔ�|�SXd�S(���sě���Extract the context for the search query from the document's full `text`. :param text: the full text of the document to create the context for :param length: the length of the context snippet to return. t����i���i����s���...t���errorst���ignoreN( ���R���t���searcht���Nonet���maxt���startt���intR���t���lent���unicodet ���TypeError(���R���R���t���lengtht���rest ���context_startt ���context_endt���context(����(����sK���/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyt���extract_context_���s���� #  $ c���������C���s���i��S(���s���Required by the HTML builder.(����(���R���(����(����sK���/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyt���context_for_searchtoolt���s����( ���t���__name__t ���__module__R���R���R���R ���R���R���R���R)���R*���(����(����(����sK���/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyR�������s���     t ���xapiansearcht ���XapianSearcht���xapiant ���whooshsearcht ���WhooshSearcht���whoosht ���nullsearcht ���NullSearcht���null(���R-���R.���(���R0���R1���(���R3���R4���(���t���__doc__R���t���objectR����t���SEARCH_ADAPTERS(����(����(����sK���/usr/local/lib/python2.7/site-packages/sphinx/websupport/search/__init__.pyt���<module> ���s ��� k