New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add skip_index feature #212
Conversation
+1 |
Why would you like to skip index? Why this is not enough? A use case would be nice :D
Then you handle indexing as you want using whatever callback you needed. |
because most of the times you want to auto_index all your search objects... except when you are, for example, importing a big bulk of data that runs in a transaction... when the import is finished you want to manually reindex all the data |
I that case wouldn't be better to have a scoped block for that? Much like it is done in |
why a scoped block when you can do it in just one statement? |
Because that way you scope the special behavior. Then it wil be very clear for others reading your code that you explicitly wanted to skip the Sunspot indexing on that particular lines of code. |
ah I see :) not a bad idea! |
It also would be great to have one spec asserting that code in that block doesn't trigger indexing ;) |
Would you mind adding a test? Thanks. |
I like the idea of selectively disabling the auto-indexing behavior, but this pull request seems to be lacking specs and a usage example, as well as consensus on what that usage should look like. Something like this will probably come up again in the future, so I am going to close this for now. Feel free to reopen with better specs and docs. In theory I'd love to toggle Sunspot's auto-indexing on and off with something like the following… Sunspot.auto_index = false
# or
Sunspot.disable_auto_indexing do
# Create a ton of records...
end But the usefulness of this behavior really is better paired with a deeper rethink of how and when indexing happens. |
as promised... a seperate commit for skip_index! feature ;)