Re: ts_headline - Mailing list pgsql-general

From Richard Huxton
Subject Re: ts_headline
Date
Msg-id 47BD67D9.8090503@archonet.com
Whole thread Raw
In response to Re: ts_headline  (Stephen Davies <scldad@sdc.com.au>)
Responses Re: ts_headline
List pgsql-general
Stephen Davies wrote:
> I just spotted the difference between your test and mine.
>
> My query says:
>
> select ts_headline(abstract,to_tsquery('english','database'),'minWords = 99,
> maxWords = 999') from document where id=21;
>
> where your equivalent does not include the 'english' arg.
>
> If I take out the 'english' from this query, I get the same result as you.

What does this give you:
   show default_text_search_config;
I get pg_catalog.english and the same result for the query whether I use:
    to_tsquery('english','database')
or to_tsquery('pg_catalog.english','database')

Could you be picking up a bad "english" configuration (see \dF)?

> However, the following returns zero rows:
>
> select title,author,ts_headline(abstract,to_tsquery('database') from document
> where clob @@ to_tsquery('database')

I take it "clob" matches "abstract"?

> It gets more interesting:
>
> select title,author,ts_headline(abstract,to_tsquery('database') from document
> where clob @@ to_tsquery('english','database')
>
> returns the "correct" result - one row with the expected headline.

Now that *is* strange. ts_headline() works without specifying 'english'
but the actual search works the other way.

> select title,author,ts_headline(abstract,to_tsquery('english','thesaurus')
> from document where clob @@ to_tsquery('english','thesaurus')
>
> also returns the "correct" result.
>
> I suggest that the above indicates a bug somewhere.

Could be - it'd be good to rule out a bad config. You might have an
unexpected list of stopwords or similar.

Let's try:
  SELECT ts_debug('the database and thesaurus');
  SELECT ts_debug('english', 'the database and thesaurus');
  SELECT ts_debug('pg_catalog.english', 'the database and thesaurus');
I'd expect "the", "and" to be stripped out as stopwords and the other
two to get through (database stemmed to "databas").


--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Stephen Davies
Date:
Subject: Re: ts_headline
Next
From: Howard Wilkinson
Date:
Subject: Re: Querying the schema for column widths - what syntax do I use?