Hi Pat,

Thank you for your input. Hopefully this will help someone else:

What I ended up doing is storing the ids of the tags as an index and storing
the tag count of each object as an attribute. I search using "1 2 3"~1,
match mode extended, and with a filter applied to the tag count (:with =>
{:tag_count => 3} in this example) It grabs the single results I need
perfectly.

It's a rather weird thing to do but I'm basically storing an object for each
possible combination of tags. We're doing filtering based on multiple tags
and I need to know which combinations are most frequently requested. It
sounds like a lot of records but most tag combinations are impossible and we
have a fairly small set of (admin controlled) tags. In a fully "open"
tagging system, this would be unlikely to work because of the sheer number
of tags.
Martin


On Sun, Jan 18, 2009 at 5:45 PM, Pat Allan <[email protected]> wrote:

>
> Hi Martin
>
> I don't think Sphinx really has the flexibility you're after,
> unfortunately - at least, not for those kinds of queries. It's not
> feasible via queries or filters (filters match what's there, or
> explicitly what's not - but you don't really want to say "Make sure
> *all* tags but 1 and 2 aren't in the set" because I think there are
> hard limits about how many values filters can be applied with (so if
> you have a few hundred thousand tags, that's not really going to work).
>
> Personally, I'd be looking to do that query using SQL, and optimise it
> with indexes as much as possible. It's not going to be a fun query
> though.
>
> Sorry I can't be more help.
>
> --
> Pat
>
> On 16/01/2009, at 6:15 AM, Martin Emde wrote:
>
> > Hi all,
> >
> > I have an object that only has tags. Each object has a unique set of
> > tags but tags are used multiple times.
> >
> > Here's an example
> >
> > A has tags [1, 2, 3]
> >
> > B has tags [1, 2]
> >
> > C has tags [2, 3]
> >
> > D has tags [1, 3]
> >
> > If I search for 1,2  or 1,3  or 2,3 how do I avoid getting A and
> > instead only get B, C or D?
> >
> > Closest I've found so far is   "1 2"~1  which will match only if
> > those tags are all right next to eachother with no words in between.
> > Only problem is that "1 2"~1  will match  "1 2 3" if I'm not mistaken.
> >
> > If there was a way to say "matches those tags and tag count is
> > exactly 2" then that would do it but I cant figure out a way to
> > index a count like that.
> >
> > Any suggestions?
> >
> > Martin
> >
> >
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to