Xapian2009: MoinMoin.search module refactoring
Today I've started MoinMoin.search refactoring. Refactoring is done because:
- no need in defining terms for xappy
stemming is done internally by xappy http://groups.google.com/group/xappy-discuss/browse_thread/thread/359ed6a9352c1154
- xappy has query parser
startrank and endrank parameters can be passed to the xappy.SearchConnection.search() As a result xapian returns only results which will be shown. (Faster search)
- xappy can summarize and highlight search results
First, I decomposed MoinMoin.search.builtin.Search class to BaseSearch, MoinSearch and XapianSearch. My goal is to make BaseSearch.search() return xappy.SearchResults (for xappy and something similar for moin search). This object can be passed to the some formatter which returns formatted results for showing them in browser. (Like MoinMoin.search.results.SearchResults.pageListWithContext() and pageList()) This will make it possible to call xappy.SearcResult.summarise. (For moin search it still needs to be done like it is done now)
Start rank and end rank is passed to the MoinMoin.search.searchPages(). Xapian returns only documents which will be shown.
I want that MoinSearch and XapianSearch perform only search based on the passed query. XapianSearch should not call MoinSearch if something needs to be post processed. It should be done by some other entity which takes care of which searchers to call, what must be done if index is not available and so on.
In addition, I plan to split builtin.py to some base file for BaseSearch and two others for MoinSearch and XapianSearch. MoinSearch related file will contain query parsers, matchers.