Skip to content
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

Closed
wants to merge 1 commit into from
Closed

add skip_index feature #212

wants to merge 1 commit into from

Conversation

dkln
Copy link
Contributor

@dkln dkln commented Apr 16, 2012

as promised... a seperate commit for skip_index! feature ;)

@rposborne
Copy link
Contributor

+1

@brutuscat
Copy link
Contributor

Why would you like to skip index? Why this is not enough? A use case would be nice :D

searchable :auto_index => false, :auto_remove => false do
...
end

Then you handle indexing as you want using whatever callback you needed.

@dkln
Copy link
Contributor Author

dkln commented Jun 21, 2012

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

@brutuscat
Copy link
Contributor

I that case wouldn't be better to have a scoped block for that? Much like it is done in ActiveRecord::Base.uncached?

@dkln
Copy link
Contributor Author

dkln commented Jun 21, 2012

why a scoped block when you can do it in just one statement?

@brutuscat
Copy link
Contributor

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.

@dkln
Copy link
Contributor Author

dkln commented Jun 21, 2012

ah I see :) not a bad idea!

@brutuscat
Copy link
Contributor

It also would be great to have one spec asserting that code in that block doesn't trigger indexing ;)

@brupm
Copy link
Contributor

brupm commented Oct 23, 2012

Would you mind adding a test? Thanks.

@nz
Copy link
Member

nz commented Sep 8, 2013

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.

@nz nz closed this Sep 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants