algoliasearch-rails icon indicating copy to clipboard operation
algoliasearch-rails copied to clipboard

Custom ranking is not bein set in the replica

Open mustela opened this issue 8 years ago • 6 comments
trafficstars

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

mustela avatar Jun 16 '17 21:06 mustela

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.

redox avatar Jun 16 '17 21:06 redox

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

mustela avatar Jun 16 '17 21:06 mustela

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.

redox avatar Jun 16 '17 22:06 redox

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?

EhsanZ avatar Aug 14 '17 12:08 EhsanZ

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.

bvogel avatar Aug 23 '23 14:08 bvogel

@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!

DevinCodes avatar Aug 25 '23 14:08 DevinCodes