当前位置: 首页 > 文档资料 > Sphinx 中文文档 >

Search Adapters

优质
小牛编辑
135浏览
2023-12-01

To create a custom search adapter you will need to subclass the

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

Parameters:changed – a list of pagenames that will be re-indexed
BaseSearch.finish_indexing()

Called by the builder when writing has been completed. Use this to perform any finalization or cleanup actions after indexing is complete.

BaseSearch.feed(pagename, title, doctree)

Called by the builder to add a doctree to the index. Converts the doctree to text and passes it to

Called by

Called by the web support api to get search results. This method compiles the regular expression to be used when

Called by

Extract the context for the search query from the document’s full text.

Parameters:
  • text – the full text of the document to create the context for
  • length – the length of the context snippet to return.