Postgres ts_headline inconsistent behaviour I have just stumbled over a weird behaviour in postgres ts_headline function (used for highlighting fulltext search results).
First I thought the simple dictionary does not play with highlighting as the below example shows (there should be &lt;b&gt; tags):

# SELECT ts_headline('simple', 'This is artificial text', to_tsquery('artificial'));
       ts_headline       
-------------------------
 This is artificial text
(1 row)


But a different word works fine...

# SELECT ts_headline('simple', 'some Word in', to_tsquery('Word'));
 ts_headline     
---------------------
 some &lt;b&gt;Word&lt;/b&gt; in
(1 row)


Does anybody have an explanation for this behaviour?
I noticed my mistake.
The to_tsquery function inside also needs to know which dictionary to use (aka use the simple one). By default it uses english stemming which produces this result:

SELECT to_tsquery('artificial');
 to_tsquery 
------------
 'artifici'


which of course can not be found in the text converted by simple dictionary.
So the correct query would have been:

# SELECT ts_headline('simple', 'This is artificial text', to_tsquery('simple', 'artificial'));
          ts_headline           
--------------------------------
 This is &lt;b&gt;artificial&lt;/b&gt; text
(1 row)