On Friday, March 27, 2015 at 3:59:40 PM UTC-7, Janko Marohnić wrote:
>
> I have a "movies" table, and after evaluating a lot of different
> strategies for full-text searching, I figured that the best way for both
> performance and simplicity is to create a new tsvector column, and store
> all fields there (and make a trigger for updating it). So, I want to do a
> simple query like this:
>
> SELECT * FROM movies WHERE content @@ to_tsquery('some query')
>
> However, I haven't found a way how to do it using #full_text_search. This
> is because "content" is already of type tsvector, and in that method that
> column is wrapped with an additional `to_tsvector()` function, which raises
> an error (`to_tsvector()` accepts only strings).
>
> For me it would be fine also to write without #full_text_search, but I
> don't know how to write custom operators ("@@") in Sequel DSL. Currently
> this part of query is just a string, and would be fine with it, but I was
> just wondering if there was a more idiomatic way.
>
Can you try the patch at http://pastie.org/pastes/10058537/text ? This
adds a :vector option to full_text_search, so you can do:
DB[:movies].full_text_search(:content, 'some query', :vector=>true)
Without the patch, currently the literal SQL string would be the most
idiomatic way.
Thanks,
Jeremy
--
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.