On 2 май, 05:40, Eric <[EMAIL PROTECTED]> wrote: > The beauty for using a search engine is you can do tag unions as easy > as tag:python OR tag:django > > or a tag intercection as: > tag:python AND tag:django > > and you can do: > tag:python AND tag:django AND tag:database > > with a sql database in order to do that you'd have to something like > this: > > SELECT * from story > inner join story2tag s2t1 on s2t1.story_id = story.id > inner join story2tag s2t2 on s2t2.story_id = story.id > inner join story2tag s2t3 on s2t3.story_id = story.id > where s2t1.tag = 'python' > and s2t2.tag = 'django' > and s2t3.tag = 'database' > > Ever new tag means another join, and it get's worse and worse > > A search engine is built for keyword searches, so it's much better > suited for that kind of thing.
If we talk about possible SQL solution to solve such task, then I would suggest storing tags in a full-text-index. That way you will be able to select them all, with relevance scores, via single SQL query without joins. We are using this version of text search: http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ Alex --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

