Closed crespire closed 1 year ago
Hi @crespire!
What is the configuration of your model? Because you're creating an index called Resource
and the error shows a different name, PressRelease
.
You can tweak the name of the index if you want (just take a look at the readme) :)
Sorry, I forgot to edit the error message. The model name is PressRelease
but changed to Resource
in sample code. That being said, I believe this particular issue was a file system persistence issue.
I'm still interested to hear about solutions for an initial index population in Rails, as that is the core problem I'm trying to solve.
Ok, so first, I think you don't need the two client
calls you did in the first place meilisearch-rails
automatically creates the index for you.
Plus, I'm thinking about the after_initialize
you opted for. You're probably loading the index somewhere else before triggering your reindex
.
Hmm, I will investigate. We've pursued the solution of running an after-deploy rake task to reindex as part of our deployment process, so I'll close the issue now.
Thanks @brunoocasali, appreciate your time and assistance!
Hey folks, new to using Meilisearch and really enjoying it so far. We are about to switch from
pg_search
tomeilisearch-rails
and I had a question about first-time setup.I understand that Meili will auto-index via AR callbacks on any new records, but if we have existing records, it doesn't seem that Meiliesearch will index anything until I manually call
reindex!
.Perhaps I have configured incorrectly?
I tried to do an
after_initialization
block but it is failing because the index does not yet exist? I'm not sure what the issue is:I keep getting a fatal error when my CI runs
assets:precompile
:Is there a way for me to automate a
Create and index resources if an index does not exist
task after initial deployment? I know Meilisearch Rails will pick up if a record is created via AR callbacks.