Closed kyrofa closed 1 year ago
Is this going to be released? I don't see this code in v.2.3.6
Can we get some proper documentation about how to use this?
Can we get some proper documentation about how to use this?
me too
➕ 1️⃣ on the docs. Or just a stupid-simple example for moots like myself.
Found something useful in tests. An example, that works for me:
class Car < ApplicationRecord
store_accessor :options, :number
end
class Driver < ApplicationRecord
has_many :cars
pg_search_scope(
:pg_search,
against: [:first_name, :last_name, :middle_name],
associated_against: {
cars: [Arel.sql("cars.options->>'number'")]
},
using: { tsearch: { prefix: true } }
)
end
But looks like tsearch
does not work for "cars.options->>'number'")
column. Trying to fix it right now. It works well for first_name, etc.
of Driver
still.
As I know tsvector
does not work with JSONB by default. As I see there is converting jsonb to string to be appropriate for tsvector
, but it does not work.
did you ever get this working?
This PR resolves #252, allowing for more more advanced columns, such as extracting elements out of json arrays, or fields out of json objects. This is intended to be entirely backward compatible.