Re: ts_headline

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: ts_headline
Дата
Msg-id 47BE8FE1.7050306@archonet.com
обсуждение исходный текст
Ответ на Re: ts_headline  (Stephen Davies <scldad@sdc.com.au>)
Ответы Re: ts_headline
Список pgsql-general
Stephen Davies wrote:
> OK. The first level explanation is that my default config is "simple".

Aha! Actually, that's the whole explanation.

> This explains the different query results as "english" reduces "database" to
> "databas" while "simple does not reduce it at all.

Exactly.

> The "document" is parsed/indexed using "english" explicitly so my queries nedd
> to be explicit also (not an issue as all "real" queries are generated rather
> than typed).

Or change your default configuration to match the one you're using.

> However, I still cannot see a reason for the ts_headline results. If anything,
> they should be the other way around.
>
> I suspect that ts_headline may only work properly when no configuration is
> specified - regardless of the default setting.

No. What's happening is that your tsvector representation of the
document (which gets indexed) contains lexemes processed by your
"english" config. So, it will have something like:
   ... databas: 123, 129, 200 ...
Of course, when you do a tsquery search with "simple" configuration it
checks doesn't do any stemming so is actually looking for a lexeme
called "database" which it can't find.

Since it can't find anything, it falls back to displaying just the start
of the document. Since the alternative would be to display nothing, that
makes a certain amount of sense.

To check this, try: ts_headline(t, to_tsquery('simple','databas')) and
you should get your database results.


Moral of the story: if you specify a configuration, always specify it.

Thanks for working through this Stephen - good question specification btw.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: "Dean Gibson (DB Administrator)"
Дата:
Сообщение: Re: client_encoding
Следующее
От: Stephen Davies
Дата:
Сообщение: Re: ts_headline