algolia / algoliasearch-rails

AlgoliaSearch integration to your favorite ORM
MIT License
410 stars 117 forks source link

Custom ranking is not bein set in the replica #240

Open mustela opened 7 years ago

mustela commented 7 years ago

Hey guys,

I have this configuration

algoliasearch(algolia_settings) do
  attribute :name, :featured_image_url, :description, :created_at, :updated_at, :organization_id, :id, :website_url
  attribute(:places) { places.map(&:to_index) }
  attribute(:tags) { tags_to_index }

  attributesToIndex [:name]

  customRanking ["asc(name)"]

  add_replica "xxxxx_venues_name_desc", inherit: true, per_environment: true do
    customRanking ["desc(name)"]
  end
end

The replica is created

screenshot 2017-06-16 23 25 23

But the ranking is empty

screenshot 2017-06-16 23 25 31
redox commented 7 years ago

Hmmmmm, that's indeed weird. Did you index at least one object after changing the settings? They are set at the first add/delete object.

mustela commented 7 years ago

Oh boy, that's interesting... I spent 2hs believing that Venue.reindex should be doing that... I just updated an object and I can see the ranking settings correctly now.

Thanks

redox commented 7 years ago

Oh boy, that's interesting... I spent 2hs believing that Venue.reindex should be doing that... I just updated an object and I can see the ranking settings correctly now.

Actually, this should work as well /o\ I'll re-read the code and check whether it's working as expected in the reindex method as well.

EhsanZ commented 7 years ago

In my case I was trying to make replicas inherit original index settings via the inherit option on the add_replica method added in #198 to forward settings to replicas. I think this line might be responsible for this?

bvogel commented 1 year ago

Dear issue, happy belated 6th birthday!

@DevinCodes do you guys have the intention to ever fix this? I just stumbled for the n-th time across a hack in our codebase, just to work around this.

DevinCodes commented 1 year ago

@bvogel thank you for the ping. I've tried to reproduce this, but haven't been able to: is this actually still an issue?

A long time has passed since this was originally opened, so it might have been resolved in the mean time without this issue being closed. You can see my attempt at reproducing the issue in #434 . This test passes locally. If there's any information that could help me reproduce this issue, it would be appreciated!

Thank you!