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

Attempt to reindex is index isn't found ( on ERR 2 (Connection refused)) #18

Closed
tyler-boyd opened this issue Aug 19, 2013 · 3 comments
Closed

Comments

@tyler-boyd
Copy link
Contributor

Hey, I think that it would be a nice addition if when there is no index present when a search is called, it attempts to create one.

For example, Product.search() should call Product.reindex if the Product.search() fails due to there being no index present.

Which brings me to a question: When should I call Product.reindex? I feel like an initializer is a bad place, as that causes rake tasks to fail when the Product table isn't present (can't recreate the database with the initializer script present).

Thanks!

PS: This gem is actually amazing and I love you forever for it.

@ankane
Copy link
Owner

ankane commented Aug 19, 2013

I've been meaning to add a section on when and when not to index :-)

Index:

  • when you install or upgrade searchkick
  • change the search_data method
  • change the searchkick method

No need to reindex when:

  • App starts
  • Records are inserted, updated or deleted (syncs automatically)

For bigger tables, indexing can take some time, so I'm a little hesitant to index automatically.

@mehulkar
Copy link
Contributor

Automatic reindex is probably not ideal. But catching the error and spitting out a helpful warning could be a nice medium

@ankane
Copy link
Owner

ankane commented Nov 2, 2013

Cleaning up issues

@ankane ankane closed this as completed Nov 2, 2013
@lock lock bot locked as resolved and limited conversation to collaborators Dec 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants