Re: Modelling tags

Поиск
Список
Период
Сортировка
От Ivan Zolotukhin
Тема Re: Modelling tags
Дата
Msg-id 751e56400708061405p19081259oee1c6cc6a39acd71@mail.gmail.com
обсуждение исходный текст
Ответ на Modelling tags  (cluster <skrald@amossen.dk>)
Список pgsql-general
Hello,

> I am thinking about how to model tags for a web site in the database.
> Is tsearch2 the way to do it?

Yes, tsearch2 is the ultimate thing for all your text work in the PostgreSQL.

> Each site entry could then store its tags
> in a tsvector. That would make me able to perform partial matches and
> rate them.

Each site entry should store its tags in tsvector definitely but for
the reasons of search only, not for ratings. It's better to separate
ratings/counters from text work usually. Default pattern I use is
inheritance of all tables from one parent table e.g. to make use of
global across entities id column. After then you create "tag" and
~"entity2tag" table which stores links to tags for your users to be
able to tag every entity stored in the database. Then couple of
triggers (for counters/ratings and full-text stuff) finish the work.
You finally are able to draw tag clouds, organize ajax suggest when
user tags smth, select entities by tag rapidly, search across entities
using tsearch2 avantages, make partial matches, etc.

Schema can be more complex if you need to store personal tags and show
them to user but one can easily extend the basic idea to get the
features needed.

Regards,
 Ivan

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: 8.1.2 select for update issue
Следующее
От: Henrik Zagerholm
Дата:
Сообщение: Re: [PERFORM] Planner making wrong decisions 8.2.4. Insane cost calculations.