Hi Mickaël I've realised recently that the reason this isn't working is because you're using a custom string for the field. Facets don't work in this situation, unfortunately, as it needs to be able to talk to the model to find out string values - and thus needs a column or association reference.
Sorry to have bad news after such a long time. That said, maybe there's a way around it - if anyone can think of a solution, I'd love to hear it. Cheers -- Pat On 22/04/2009, at 2:01 AM, Mickaël Allain wrote: > Hi all, > > Currently, I'm trying to design a define_index bloc. > > My define_index is like this > > define_index do > indexes "(SELECT creator_id FROM `articles` UNION SELECT > creator_id FROM `documents` UNION SELECT creator_id FROM `wikis` > GROUP BY creator_id LIMIT 0 , 30)", :as > => :ts_article_creator, :facet => true > > # Propriete sur les recherches > set_property :enable_star => 1 > set_property :min_prefix_len => 1 > > end > > I want to facetize my indexes :ts_article_creator. Without > option :facet => true, the expected result is right. > > But, in my case, it doesn't work, the result is > > <pre>undefined method `(SELECT creator_id FROM `articles` UNION > SELECT creator_id FROM `documents` UNION > SELECT creator_id FROM `wikis` GROUP BY creator_id LIMIT 0 , 30)' > for #<Article:0x7e52d18></pre > > > <div id="Application-Trace" style="display: block;"> > <pre><code>/opt/ree/lib/ruby/gems/1.8/gems/activerecord-2.2.2/ > lib/active_record/attribute_methods > .rb:260:in `method_missing' > app/models/article.rb:351:in `method_missing' > app/controllers/searches_controller.rb:109:in `create'</code></pre> > </div> > > <div id="Framework-Trace" style="display: none;"> > <pre><code>/opt/ree/lib/ruby/gems/1.8/gems/activerecord-2.2.2/ > lib/active_record/attribute_methods > .rb:260:in `method_missing' > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet.rb:84:in > `send' > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet.rb:84:in > `translate' > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet.rb:27:in > `value' > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/ > facet_collection.rb:20:in `add_from_results' > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/collection.rb: > 123:in `each_with_groupby_and_count > > Complete log http://pastebin.com/f5492d75c > > Anyone has already do this ? > > Any help will be greatly appreciate. > > Best regards, > > Mickaël > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en -~----------~----~----~----~------~----~------~--~---
