Looking for advice on tags handling

0 views
Skip to first unread message

Thibaut Barrère

unread,
Jan 6, 2009, 4:13:34 AM1/6/09
to thinkin...@googlegroups.com
Hello,

just thinking out loud, I'd appreciate some feedback from more experienced users.

Is there some thinking-sphinx way to filter output on tags that would be kept inside one column as a string (like "tag,tag1,tag2") instead of having it stored inside a separate table like with more classing tagging systems ?

Or should I use some formatting like "[tag1][tag2][tag3]" then a full text search on the corresponding index ?

thanks,

Thibaut Barrère
--
[blog] http://evolvingworker.com - tools for a better day
[blog] http://blog.logeek.fr - about writing software

Christian Rishøj

unread,
Jan 6, 2009, 6:43:55 AM1/6/09
to thinkin...@googlegroups.com

Hi Thibaut

The "clean" way to support tags would probably rely on multi-valued attributes [1]. 

Ignoring this, and assuming your current data model, you should note that Sphinx is a fulltext search engine. If your tags do not contain spaces themselves, spaces would be a good separator. I think a format such as "tag_1 tag_2 ... tag_N" would meet your needs.

Christian



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
To post to this group, send email to thinkin...@googlegroups.com
To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---


Thibaut Barrère

unread,
Jan 7, 2009, 4:28:49 AM1/7/09
to Thinking Sphinx
Hi Christian,

thanks for your reply.

> The "clean" way to support tags would probably rely on multi-valued   attributes [1].

Is it something that is supported by TS itself ? (I presume yes after
reading the front page, but can't find more examples - are there
examples somewhere ? (I found something more or less related here:
http://groups.google.com/group/thinking-sphinx/browse_thread/thread/921b4ca4e27feb4c/46d2ce49a262ae06)

> Ignoring this, and assuming your current data model, you should note  
> that Sphinx is a fulltext search engine. If your tags do not contain  
> spaces themselves, spaces would be a good separator. I think a format  
> such as "tag_1 tag_2 ... tag_N" would meet your needs.

that could do the trick too, yes. Thanks for the hint!

-- Thibaut

John Bresnik

unread,
Jan 7, 2009, 4:42:01 AM1/7/09
to thinkin...@googlegroups.com
Make sure you set your match mode to 'any' - believe the default is to 'all'

User.search 'joe', :match_mode => :any

brez

Pat Allan

unread,
Jan 7, 2009, 4:43:13 AM1/7/09
to thinkin...@googlegroups.com
Hi Thibaut

MVA's are only for integers - so that'd only work if your tags are
separate models, and you have an attribute for the foreign key.
Otherwise, the space-separated tags is the best and simplest approach,
I think.

Cheers

--
Pat

Thibaut Barrère

unread,
Jan 7, 2009, 5:38:32 AM1/7/09
to Thinking Sphinx
Thanks guys for the feedback.

I guess I'll stick with html-encoded attributes (so I can tag "Best
Stuff" using "Best%20Stuff" and use the space-separated tags trick).

thanks!

-- Thibaut
Reply all
Reply to author
Forward
0 new messages