Hi Pierre Sorry this response isn't so prompt.
STI support with multiple indexes is still a bit flaky - as you've found. I think the best approach is to define an index on Item that covers both title and description - as the description column does exist for both, even if you're not using it for Article. NULLs will end up as blank strings, so that won't be a problem. And remove the define_index block for Article. If you do have data in description for Articles that you don't want indexed, then a not-quite-elegant workaround would be something like (and I'm guessing the SQL IF function syntax): indexes "IF(type = 'Item', description, '')", :as => :description And I'll try to spend some time on multiple indexes per model, but it's not as high a priority as finishing facets and adding excerpts, unfortunately. Cheers -- Pat On 19/01/2009, at 6:55 PM, Pierre wrote: > > Hello everyone, > > First of all, thanks to everyone who contributed to this fantastic > plugin ! I really love it, it's so great for full text searches ! > > I have just a question. I use STI models : > > class Item > end > > class Article < Item > end > > And I want to just different define_index parameters for Article and > Item, so that I can query Item and Article differently. > > I would like to do : > class Article < Item > define_index do > indexes title > end > end > > and > > Class Item > define_index do > indexes title > indexes description > end > end > > And then use Article.search and Item.search > > But I have the following error : > > ERROR: section 'item_0_core' (type='source') already exists in /Users/ > pierre/rails/site/config/development.sphinx.conf line 114 col 1. > FATAL: failed to parse config file '/Users/pierre/rails/site/config/ > development.sphinx.conf'. > > Is there any way to find a solution ? > > Thank you very much in advance, > > Pierre > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
