Motivation for Proposal/ Goal
Improving and Extending the PHPBB Search Backend will provide faster and more efficient search capability. It will also make the interface more user friendly by introducing filters. Open Source Search backends like- Sphinx, Lucene are very important for forums which have huge databases. I chose Sphinx because of its easy integration with SQL and PHP. If time permits (or perhaps after GSOC) I would like to get started with integrating some other search backend (Lucene or Solr) too.
What I have
Nils Adermann (IRC: naderman) has already made a pre alpha implementation of Sphinx Search Backend [http://github.com/naderman/sphinx-for-phpbb]. A user (wagnerch) has submitted a patch for PostgreSQL Fulltext search, some of its code can be used [http://area51.phpbb.com/phpBB/viewtopic.php?f=4&t=28707&hilit=postgresql].
Oleg has also been working on a branch for PostGreSQL FUlltext search [https://github.com/p/phpbb3/tree/feature/postgresql-fulltext-search]
The PG Search will be targetting PG version 8.3+
What I need to do
The abstraction of current search backends can be improved so as to decrease code duplications and effective implementations. Ability of the backend to modify the search interface would work great as interface can be modified according to the search backend being used. Filters can be introduced to narrow down the search results. Extending the current search backend to index tables other than posts, forum and topics table to MODS/ext which will be useful in the Moderator Control Panel and introducing filters which will make searching a better experience. The implementation of Sphinx search will need to be refined and modified according to the new abstraction scheme. PostgreSQL Fulltext search class will have to be written from scratch, small snippets of code and some idea can be inherited from the submitted patch.
Benefits to the Community
The search with better abstraction will certainly make implementation of new search backends easier and the search feature as a whole faster and efficient. PostgreSQL Fulltext and Sphinx search will give forum admins an added functionality for a search backend. Sphinx in particular is a very powerful open source search system having many advantages over the native MySQL Search. The user interface will include different filters so as to make searching flexible and easier to use. In addition the current search implementations indexes only the posts, forums and topics table, an added extension to index MOD/extensions and Private Messages tables will certainly for a better PHPBB user experience.
Potential Problems
Some of the current search backend methods have too many parameters, may need to be refined completely during abstraction.
Each search backend may need to be broken into multiple classes for proper implementation.
Adding/ Removing search interface controls through the backend may prove to be difficult to implement in view of the current code.
Initial Thoughts/ Implementations
I would first like to make a prototype of the class structure in particular, implementing proper abstraction. This will be done in such a way that integrating new search backends becomes fairly easy. Various functions of the current backends will be made to inherit (phpbb_search_base class already does this to an extend but this can be improved further). The Sphinx and PostgreSQL Fulltext alpha implementations would serve as a reference to writing the new classes. Many of the methods could be inspired, changing their parameters will be required though.
Search backend, able to modify the search user interface, will require new method definitions which will need to be made flexible and at the same time secure. I would try to make a rough model of all these classes, methods and the basic search structure, and like to discuss this with my mentor and community before the actual coding begins.
Near Term Goals
Install, Configure and get Sphinx search and PostGreSQL search implementations to work. Keep a rough draft of the steps to make documentations easier. I will be contributing a wiki page to what configuration parameters these 2 search backend have and how to configure them.



