I have a django application and I am trying to use a field named external_id, that is a UUID string to build my SearchVector (from django.contrib.postgres.search) .
The problem is that the search_vector being created in the Postgres DB is splitting the strings between the hyphens, for example:
external_id = 5f4ffd5b-0738-4aa4-8961-3114b54d1e20
search_vector =
'-0738':2 '-3114':6 '-4':3 '-8961':5 '5f4ffd5b':1 'aa4':4 'b54d1e20':7
So, when I am trying to search for the complete UUID, I do not get a match, but searching for the parts created in the search_vector matches, like: 5f4ffd5b or -8961.
I have tried changing my Postgres search configuration using:
CREATE TEXT SEARCH CONFIGURATION public.my_search_config (copy=simple);
ALTER TEXT SEARCH CONFIGURATION public.my_search_config
DROP MAPPING FOR hword, hword_part, word, word_part;
CREATE MAPPING FOR asciiword, asciihword, hword_ascii WITH simple;
but got:
SQL Error [42601]: ERROR: syntax error at or near "MAPPING"
Position: 8
I have also tried to modify the text search parser:
ALTER TEXT SEARCH PARSER default_parser
SET TOKEN_TYPE = 'word', START = 'a' , GETTOKEN = 'dsimple';
but got:
SQL Error [42601]: ERROR: syntax error at or near "TOKEN_TYPE"
Position: 45