Closed AliOsm closed 11 months ago
One difference, in development I'm using the latest meilisearch docker image, while in production I'm using v1.1.1, could this be the issue?
I tried with v1.1.1 on development and it works fine.
Other observation is when I run Hadith.reindex!
it takes minutes before finish, which means there is a process happens behind the scene, but I can't see any logs.
I just found the issue. I created a meilisearch ruby client and tried to add a document to the index by hand as follows:
require 'meilisearch'
client = MeiliSearch::Client.new('http://127.0.0.1:7700', 'key')
index = client.index('Hadith')
index.add_documents([{id: 1, searchable_text: 'test', author: 'test', hadith_book_id: 1, source: 'lk'}])
Then, when I checked the tasks I found the following issue:
client.tasks
# The primary key inference failed as the engine found 2 fields ending with `id` in their names: 'id' and 'hadith_book_id'. Please specify the primary key manually using the `primaryKey` query parameter.
So, I changed hadith_book_id
to hadith_book
by defining the attribute as a block and the issue resolved.
I think I can use primary_key: :id
with meilisearch block, but this works for now :)
Description I have the following Rails model:
When I create records in it, I can't index them in meilisearch index. I tried using Hadith.reindex! and Hadith.first.index!, then umber of documents is always 0.
Also, I tried to restart the meilisearch service, re-creating the index, and re-deploying the app, nothing worked.
On development it works fine, but in production it is not working!
This issue happens, while other Rails models can be indexed as usual.
Expected behavior Documents to be indexed.
Current behavior No document is indexed.
Environment (please complete the following information):
meilisearch --version => meilisearch 1.1.1
gem 'meilisearch-rails', '~> 0.10.1'
gem 'rails', '~> 7.0', '>= 7.0.8'