averell23 / chewy_kiqqer Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi there,
Firstly great work on the gem(s).
I have a question regarding the use of factory_girl for testing.
Making use of:
product.rb
async_update_index index: 'products#product', backref: :self
and of course
spec_helper.rb
require 'sidekiq'
require 'sidekiq/testing'
require 'fakeredis/rspec'
I cant seem to get objects into the running test Elasticsearch server:9250.
Is this a known use-case? and are there any tips you can provide?
Hi there, I am finding this gem very useful, thanks for writing it!
In my use case I am indexing the foreign keys of associated habtm records, and wanting to trigger a reindex when a record is added to or removed from the habtm association.
These add and remove events naturally do not trigger after_commit
on the subject model.
The habtm after_add:
and after_remove:
hooks pass the added/removed object into the hook method, so I cannot give them :queue_chewy_jobs
because that method takes no parameters.
One idea I had was to wrap queue_chewy_jobs
in my own method that stripped the argument passed by the habtm after_add:
and after_remove:
hooks, so that I could continue to do all the heavy lifting in my async_update_index
methods. But this wasn't adequate for my purposes because once within the async_update_index
method I have no way of detecting whether or not the habtm changed (I am doing filtering to prevent unnecessary reindex jobs).
So in the end I just call ChewyKiqqer::Worker.perform_async
directly from my own hook method, and this works fine.
I don't think there are any easy wins here (this gem is elegant the way it is), but thought to create this issue in order to discover if other folks are interested in reindexing habtm foreign keys when those keys change with chewy_kiqqer. (for example, I find this model useful for sideloading associated records from activerecord after retrieving search results directly from chewy) Maybe over time a better solution will emerge...
I'm getting this issue when starting rails server. I think if it's a gem dependency we must add it to the gemspec. We've required redis-namespace in https://github.com/averell23/chewy_kiqqer/blob/master/lib/chewy_kiqqer/worker.rb but have not included it as dependency.
Any chance to support 1.9.3 MRI?
Hi, I really like your gem but I'm having some trouble writing good rspecs to tests index updates...
The chewy gem itself provides quite nice spec helpers in the form of
specify { expect { [user1, user2].map(&:save!) }.to update_index(UsersIndex.user).and_reindex(user1) }
But this doesn't work with async index update.
FYI: I'm using Sidekiq inline in rspecs:
#spec_helper.rb
if example.metadata[:sidekiq] == :inline
Sidekiq::Testing.inline!
end
#users_index_spec.rb
describe UsersIndex, sidekiq: :inline do
....
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.