pat/thinking-sphinx — pull request #619 by weetu (2013-09-26 10:07:16+00:00)
Title: Do not clobber :select option in facet search

Facets did not work if using a custom attribute created using :select and then having that attribute used e.g. in :order:

ThinkingSphinx.search('foo', :classes=>[Brand], :select=>'*,@weight as custom_relevance', :order=>'custom_relevance ASC').facets.to_hash
ThinkingSphinx::SphinxError: index brand_core,brand_delta: sort-by attribute 'custom_relevance' not found

After this patch, that works:
irb(main):002:0> ThinkingSphinx.search('foo', :classes=>[Brand], :select=>'*,@weight as custom_relevance', :order=>'custom_relevance ASC').facets.to_hash
=> {:sphinx_internal_class=>{"Brand"=>2}, :owner=>{82=>2}, :class=>{"Brand"=>2}}