Great to hear that TS is still working out well for you :) > On 17 Oct 2015, at 3:14 am, Anrake <[email protected]> wrote: > > Pat, Thank you so much for the help. That took care of it. I had actually > tried the same in one iteration of trial&error but I guess the reason is that > the field was a string, not integer. It's a preexisting database, but I can > work around that. > > I have another project that has been using the faceting engine of TS since > 2009. This is my first project using TS since then and am thrilled to see > it's still going strong. TS is great and I really appreciate all your hard > work on it over these years! > > On Friday, October 16, 2015 at 7:48:54 PM UTC+9, Pat Allan wrote: > I think switching to an attribute (using the `has` method) will result in > better facet results: > > has visits.visit_year, :as => :visited, :facet => true > > It’s worth noting that the :type option has no impact on fields, and for > attributes, there are two separate options, :type (which in this case would > be :integer) and :multi (accepting a boolean). Given it’s a has_many > attribute, :multi will automatically be set to true, and if the visit_year > column in your database is an integer type, then that’ll automatically be > detected by Thinking Sphinx as well. > > If you want users to be able to search for the year within their queries as > well, then you’ll want a field *as well* - just make sure the field and the > attribute don’t have the same name. > > indexes visits.visit_year, :as => :visit_year > has visits.visit_year, :as => :visited, :facet => true > > Kind regards, > > — > Pat > >> On 16 Oct 2015, at 9:37 am, Anrake <eric...@ <>gmail.com >> <http://gmail.com/>> wrote: >> >> When I index a field via a has_many relationship the facets that come out >> are a joined facet of all the values. >> >> In the index I have this >> >> indexes visits.visit_year, :type => :multi, :as => :visited, :facet => >> true >> >> but the facets that come through look like this instead of individual values >> for each year >> >> 1996 1997 1998 2004 2009 2012 (1) >> 2001 (4) >> 1999 2009 2010 (1) >> 1992 2001 2003 2004 2011 2012 2013 2014 2015 (1) >> >> This is a database of historical sites and the has_many for visits are the >> years we surveyed them. >> >> details: >> ruby 2.2 >> rails 4.2 >> thinking_sphing: 3.1.4 >> >> Thank you. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Thinking Sphinx" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to thinking-sphi...@ <>googlegroups.com <http://googlegroups.com/>. >> To post to this group, send email to thinkin...@ <>googlegroups. >> <http://googlegroups.com/>com <http://googlegroups.com/>. >> Visit this group at http://groups.google.com/group/thinking-sphinx >> <http://groups.google.com/group/thinking-sphinx>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/thinking-sphinx > <http://groups.google.com/group/thinking-sphinx>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>.
-- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
