In local DB I have 5 videos with titles: Test new video, Testing*, *
testiest, New name video, Videos
When I make request
*Video*.dataset.full_text_search(:title, *'*vid*'*, {phrase: *true*}).all
I get empty array.
I get raw SQL of this request
#<Sequel::Postgres::Dataset: "SELECT * FROM \"videos\" WHERE
((to_tsvector(CAST('simple' AS regconfig), (COALESCE(\"title\", ''))) @@
plainto_tsquery(CAST('simple' AS regconfig), 'vid')) AND
(((COALESCE(\"title\", '')) ILIKE '%vid%' ESCAPE '\\')))">
and run last part
*DB*.fetch(*"*SELECT * FROM videos WHERE ((COALESCE(title, '')) ILIKE
'%vid%' ESCAPE '*\\*')*"*).all
and get expected 3 videos
Then I run
*DB*.fetch(*"*SELECT * FROM videos WHERE ((to_tsvector(CAST('simple' AS
regconfig), (COALESCE(title, ''))) @@ plainto_tsquery(CAST('simple' AS
regconfig), 'vid')))*"*).all
and get empty array.
Then I check dictionaries and simple dictionary:
*DB*.fetch(*"*SELECT dictname FROM pg_catalog.pg_ts_dict;*"*).all
=> [{:dictname=>*"*simple*"*}, ... ]
*DB*.fetch(*"*SELECT * FROM ts_debug('vid');*"*).all
=> [{:alias=>*"*asciiword*"*, :description=>*"*Word, all ASCII*"*, :token=>
*"*vid*"*, :dictionaries=>*"*{simple}*"*, :dictionary=>*"*simple*"*,
:lexemes=>[*"*vid*"*]}]
Of course, I can use
*Video*.where(*Sequel*.ilike(:title, *'*%vid%*'*)).all
but maybe I do something wrong with full_text_search ??
Thank you =)
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.