Various code that could potentially be adapted to work as a QGIS gazetteer plugin that connects to Postgres (and other forms of database too) and uses the full text search feature.