I’m using the webmock template you’ve provided. When I’m looking at the source for that template I see that it returns objectID 42 as a match for every query.
However - when I run
Model.search the results returned are always empty.
I’m probably missing something as usual when issues like this arise, but could you point me in the right direction?
The specs are fairly simple:
it "should find a user" do user = create(:user, id: 42) fill_in "search", with: user.email expect(page).to have_content(user.first_name) end
WIth user model containing this:
algoliasearch do attribute :first_name, :last_name, :email, :phone searchableAttributes ['first_name', 'last_name', 'email', 'phone'] end
and the search controller just doing this simple search:
@users = User.search(search_string)
I’ve verified with byebug that the search_string is intact and that
User.search indeed just returns an empty array.