﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29084	Skip postgres_tests's SimpleSearchTest's that require 'english_stem' configuration if the machine's configuration is different	Дилян Палаузов	Pablo Nicolas Estevez	"tests/postgres_tests/test_search.py:class SimpleSearchTest contains:

{{{
def test_non_exact_match(self):
    searched = Line.objects.filter(dialogue__search='hearts')
    self.assertSequenceEqual(searched, [self.verse2])

def test_search_two_terms(self):
    searched = Line.objects.filter(dialogue__search='heart bowel')
    self.assertSequenceEqual(searched, [self.verse2])
 
}}}

The first test calls:
> SELECT to_tsvector('His head smashed in and his heart cut out, ') @@ plainto_tsquery('hearts')

which is false.  In particular:
{{{SELECT to_tsvector('His head smashed in and his heart cut out, ');}}} returns {{{'and':5 'cut':8 'head':2 'heart':7 'his':1,6 'in':4 'out':9 'smashed':3}}} and {{{SELECT plainto_tsquery('hearts');}}} returns {{{'hearts'}}}.

However this works:

> SELECT to_tsvector('english', 'His head smashed in and his heart cut out, ') @@ plainto_tsquery('english', 'hearts');

as {{{SELECT to_tsvector('english', 'His head smashed in and his heart cut out, ')}}} returns {{{'cut':8 'head':2 'heart':7 'smash':3}}} and {{{SELECT plainto_tsquery('english', 'hearts');}}} returns {{{heart}}}.

The second test calls:

> SELECT to_tsvector(COALESCE('His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off, And his--')) @@ plainto_tsquery('heart bowel');

which is again false.  In particular {{{SELECT COALESCE('His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off, And his--');}}} returns {{{His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off, And his--}}}, {{{SELECT to_tsvector(COALESCE('His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off, And his--'));}}} returns {{{and':5,10,14,18,22,27 'bottom':24 'bowels':16 'burned':25 'cut':8 'head':2 'heart':7 'his':1,6,11,15,19,23,28 'in':4 'liver':12 'nostrils':20 'off':26 'out':9 'removed':13 'ripped':21 'smashed':3 'unplugged':17}}} and {{{SELECT plainto_tsquery('heart bowel');}}} returns {{{'heart' & 'bowel'}}}.

Here again 'english' helps:
{{{SELECT to_tsvector('english', COALESCE('His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off, And his--'));}}} returns {{{'bottom':24 'bowel':16 'burn':25 'cut':8 'head':2 'heart':7 'liver':12 'nostril':20 'remov':13 'rip':21 'smash':3 'unplug':17}}} and
> SELECT to_tsvector('english', COALESCE('His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off, And his--')) @@ (plainto_tsquery('heart bowel'));
is true.
"	Cleanup/optimization	closed	contrib.postgres	1.11	Normal	fixed	tests postgresql search		Ready for checkin	1	0	0	0	0	0
