MDL-26371 sql - avoid distinct + text in glossary search