Postgresql – Full text search partial search with ‘in:*’ not working

full-text-searchpostgresql

select to_tsvector('english', 'JAVA') @@ to_tsquery('english','ja:*');

select to_tsvector('english', 'india') @@ to_tsquery('english','in:*');

The first one is returning true while the second is returning false. How to address this?

Best Answer

That is because "in" is a very frequent word in the English language, so it is eliminated as a "stopword".

You could use the simple text search configuration, but I suspect that full text search is not the right tool for this. Trigram indexes work better for substring searches, but nothing will really work well for strings as short as two characters.