Dom Hodgson
Dom Hodgson

Reputation: 508

Tire Gem with Ransack for elasticsearch

I've been using Ransack with my MySQL data to produce an advanced form, I've switched over to elasticsearch recently and now I'm finding that even a simple form doesn't work (using the activerecord functionality within tire)

A simple form produces the error 'No valid predicate for x' where x is what I'm searching for..

Searching around, either I'm the only one who has tried this or it works for everyone else?

Am I missing something?

 index.html.erb    
   <%= search_form_for @q do |f| %>
      <%= f.label :attendees %>
      <%= f.text_field :attendes %>
      <%= f.submit %>
    <% end %>

    <%=  @events.inspect %>

Events controller

def index
    @q = Event.search(params[:q])
    @events = @q.result
end

event.rb

  include Tire::Model::Search
  include Tire::Model::Callbacks

Upvotes: 1

Views: 1061

Answers (1)

Ivailo Bardarov
Ivailo Bardarov

Reputation: 3895

Ransack search object can't generate Tire search.

There is no adapter for the elastic search, only AR

https://github.com/ernie/ransack/tree/master/lib/ransack/adapters

Upvotes: 1

Related Questions