Re: Most efficient way to achieve this ts_query

Поиск
Список
Период
Сортировка
Искать
От
Jamie Tufnell
Тема
Re: Most efficient way to achieve this ts_query
Дата
Msg-id
b0a4f3350810152141g6de5deb6m106e22e4d08cf8a@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Most efficient way to achieve this ts_query "Jamie Tufnell" <diesql@googlemail.com>
Re: Most efficient way to achieve this ts_query Frank Bax <fbax@sympatico.ca>
Re: Most efficient way to achieve this ts_query "Jamie Tufnell" <diesql@googlemail.com>
On 10/16/08, Frank Bax  wrote:
> Jamie Tufnell wrote:
>> If someone uses a search query on my site like this:
>>
>> "abc def"
>>
>> I would like to return all results for 'abc & def' first, followed by
>> all results for tsquery 'abc | def' is there some way to express this
>> in one tsquery?  What's the most efficient way to go about this?  The
>> search is on one column.
>
>
> SELECT * FROM table WHERE field='abc' OR field~'def'
> ORDER BY CASE WHERE field~'abc' AND field~'def' THEN 1 ELSE 0 END DESC;

I am using tsqueries though (to_tsquery() and to_tsvector()) to
benefit from stemming.

I understand how your approach might still apply, but I'm curious to
know if that's the best way, or can it be done in a single
to_tsquery(), with a single MATCH ?

Thanks,
Jamie

В списке pgsql-sql по дате отправления
От: Raj Mathur
Дата:
От: Oliveiros Cristina
Дата:
FAQ