Wow, this is fantastic news! Thank you very much Pat for all the work you put into TS.
On Jul 26, 6:43 pm, Pat Allan <[email protected]> wrote: > Hi everyone > > For those who didn't see my tweet yesterday, I've added two pretty big > features to TS over the last week, and pushed the changes to GitHub > yesterday (and thus the latest version is now 1.2). > > First up, the much desired excerpts support. Thinking Sphinx will > automatically add an excerpts object to each search result, and that > uses the underlying object's methods for the initial data. > > �...@articles = Article.search 'pancakes' > �[email protected] do |article| > article.excerpts.content > end > > On the off chance you already have a method called excerpts on your > model, then it won't be overwritten, and you'll have to use the > slightly less clean syntax instead: > > �...@articles = Article.search 'pancakes' > �[email protected] do |article| > �[email protected]_for(article.content) > end > > The other big feature is Sphinx Scope, which is equivalent to > ActiveRecord's named_scope - add scopes to your model, then chain them > together to combine different filters, field conditions, etc. > > sphinx_scope(:by_name) { |name| > {:conditions => {:name => name}} > } > > Article.by_name('Pat').each do |article| > # etc > end > > You cannot combine these with named scopes (because they are SQL, and > Sphinx has its own syntax). > > Anyway, both of these features are ready to be used - if you hit any > issues, or have any questions, let me know. > > Cheers > > -- > Pat > e: [email protected] || m: +614 1327 3337 > w:http://freelancing-gods.com|| t: twitter.com/pat > discworld:http://ausdwcon.org|| skype: patallan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
