Hi Bo The quick answer is that I can't think of any way to do this that maintains the weighting for articles tagged more than once with a given tag. If that wasn't necessary, then I'd suggest creating an attribute of the tag ids, and filter by that.
Sorry for the delay in a not-particularly-helpful answer. -- Pat On 26/11/2010, at 4:20 PM, Bodaniel Jeanes wrote: > So I have a situation where I want to search one model (let's say > Article) and it can be tagged, a la ActsAsTaggableOn. Furthermore, > they can be tagged with the same tag multiple times (by different > people, so the article gets a heavier weighting for that tag – think > de.licio.us). > > If I have indexes as such: > > define_indexes do > indexes taggings.tag.name > > #... > end > > then I can search across those tags fine. E.g. if I tag an article > with "ruby, rails, programming", the article is shown if I search for > any of those terms. The way sphinx indexes the associated tags is by > concatenating them all into one big text index that, for an article > tagged multiple times with the same tag, might look like "ruby ruby > ruby rails ruby programming ruby programming rails programming". > > The problem lies in the fact that my system allows for tags with > spaces in it, and sphinx concatenates all my keywords together in one > index. This means that if I tag an Article with "martial arts" as a > discrete tag, searching for "arts" will match that Article. This isn't > necessarily the worst problem to have, but there's a good bet that > when a user searches arts they weren't expecting to get Articles > relating to martial arts. Some people may, but there's other scenarios > like "housing development" and searching for "development" (as in > software). > > Any thoughts about how the index could be manipulated in a way that > let me search for discrete tags across all articles, maintaining the > ability to weight articles heavier if it's tagged multiple times? > > Cheers, > Bo > > -- > 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. > -- 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.
