Re: Most efficient way to achieve this ts_query

Поиск
Список
Период
Сортировка
От Frank Bax
Тема Re: Most efficient way to achieve this ts_query
Дата
Msg-id 48F6B9C9.4070401@sympatico.ca
обсуждение исходный текст
Ответ на Most efficient way to achieve this ts_query  ("Jamie Tufnell" <diesql@googlemail.com>)
Ответы Re: Most efficient way to achieve this ts_query
Список pgsql-sql
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;


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

Предыдущее
От: "Jamie Tufnell"
Дата:
Сообщение: Most efficient way to achieve this ts_query
Следующее
От: Raj Mathur
Дата:
Сообщение: Search fields in multiple tables