Wikia/app — pull request #1171 by relwell (2013-07-23 16:36:06+00:00)
Title: Major Search Refactor: Accommodate multiple cores, use new cross-wiki core, ArticleService update

This is a major refactor that increases the quality and coverage of the search library while introducing support for new features.

**tl;dr** ***This is a large refactor to the Wikia\Search library, specifically around querying, to allow us to use the new cross-wiki core in Solr, which provides major performance improvements. Several other performance improvements and architectural improvements have also been introduced.***

### Multiple Cores
An update has been made to the config / testprofile / query service components to accommodate multiple cores and the separate schemata that accompany them. This includes injecting the selected core into the solarium config from the query service using accessor methods, and reassigning responsibility for maintaining query fields.

During this change, we move our query services into two separate subnamespaces -- DisMax and Lucene. Those in the Lucene subnamespace only work against basic Lucene query syntax, and have a limited set of methods associated with those actions. Those query services that are in the DisMax subnamespace contain all methods associated with preparing a DisMax style query. Both of these subnamespaces have an abstract parent class for shared methods, and both of those inherit from an abstract class in the Select parent namespace for the purpose of shared parameter configuration between both query approaches.

### Cross-Wiki Core
Wikia\Search\QueryService\Select\Dismax\InterWiki now uses the xwiki core, which is already on all production query servers. Usage of this core provides a major improvement in average cross-wiki search speeds, from an average 1.5 seconds to around 15ms.

### SolrDocumentService
We introduce a service capable of accessing a single result based on its ID for both on-wiki and cross-wiki results. In the future these will be used in finding cross-wiki exact matches via Solr for even better performance improvements. Presently, we use them as a performance improvement for building out exact matches as found in Solr, making template logic consistent and reducing code duplication.

### Update to ArticleService
The ArticleService is updated to access preprocessed text from Solr using the SolrDocumentService, with its previous approach as a backoff for degenerate cases where the document cannot yet be found in Solr. This has been shown to provide at least a 4x improvement in the performance, and addresses an open P3 (PLA-283) with respect to Runescape wiki meta description tags.

### More Robust Per-Service Configurations in A/B testing platform
Along with a few other characteristics, we can now use A/B tests to tweak and analyze new parameters for each query service to make sure our approach is suitable for every use case. One such new example is the DisMax tie parameter.