Help needed - Searching using Postgres full text search
francescob opened this issue · 1 comments
Hi, first of all thanks for the very nice work on this gem.
I'm trying to implement a custom search using the pg_search gem (https://github.com/Casecommons/pg_search) which builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search.
I'm defining my column like this:
title: { source: "LifeCycleMethod.title", searchable: true, cond: full_text},
and then defined the full_text method like this:
def full_text
->(column, value) do
::Arel::Nodes::SqlLiteral.new(LifeCycleMethod.full_text_search(value).to_sql)
end
end
but I'm getting this error:
ActiveRecord::StatementInvalid (PG::SyntaxError: ERROR: subquery must return only one column
The search scope alone is working correctly, so I think I'm probably using it wrong inside my Datatable class, and I hope you can help me
Why not using https://github.com/Casecommons/pg_search#pg_search_scope in get_raw_records?