I'm using an dict_xsyn extension in postgres which returns multiple lexemes.
CREATE EXTENSION dict_xsyn; CREATE TEXT SEARCH DICTIONARY names_xsyn (TEMPLATE = 'xsyn_template'); CREATE SEARCH CONFIGURATION english_names ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH names_xsyn, simple; SELECT to_tsquery('english_names', 'ed') -- returns: 'ed' & 'edward' & 'edwin' & 'edmond'
I would prefer if to_tsquery returned ORed lexemes so that I could match to other variants. e.g.
-- returns: 'ed' | 'edward' | 'edwin' | 'edmond'
I've tried ts_rewrite but that doesn't seem to support swapping logical operators.
--Edit I'm doing this so that I can match partially matching sets. e.g. I want ed to match edward and edwin, but I don't want edward to match edwin. Here are my lexemes:
ed -> ed, edward, edwin
edward -> ed, edward
edwin -> ed, edwin
Using those lexmes to match ed to edward will only work with an or.
"ed, edward" @@ "ed | edward | edwin" will work
"ed, edward" @@ "ed & edward & edwin" won't work