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

Atomic reindex creates tmp index with empty setting #455

Open
metheglin opened this issue Nov 27, 2024 · 0 comments
Open

Atomic reindex creates tmp index with empty setting #455

metheglin opened this issue Nov 27, 2024 · 0 comments

Comments

@metheglin
Copy link

metheglin commented Nov 27, 2024

  • Rails version: 7.0.2
  • Algolia Rails integration version: 3.0.0
  • Algolia Client Version: 3.7.1
  • Language Version:

Description

Atomic reindex (ex: Product.reindex) is always going to create tmp index with empty setting when check_settings=true. When index move completed, previous settings disappeared. Not only specified settings inside algoliasearch block, but manual setting on dashboard.

When check_settings=false this problem seems not happening.
When check_settings=true, after task done the settings of new index is always empty even though settings(customRanking,searchableAttributes,...) described in algoliasearch block (See Step to Reproduce).

By the way, I executed set_settings command manually with my setting like below and it does work. So I guess it happens because algolia_ensure_init missed when check_settings=true.

resp = AlgoliaSearch.client.set_settings(
  'Product_development', 
  Algolia::Search::IndexSettings.new({
    "searchable_attributes"=>["fulltext_search"],
    "custom_ranking"=>["desc(updated_at_i)"],
    "replicas"=>["Product_price_asc_development", "Product_price_desc_development"]
  })
)

Please check PR for better understanding. #453

Steps To Reproduce

app/models/product.rb

class Product < ApplicationRecord
  algoliasearch check_settings: true do
    attribute :title
    attribute :content
    attribute :updated_at_i
    
    customRanking ['desc(updated_at_i)']
    searchableAttributes ['title']
    indexLanguages ['ja']
  end
end

in rails console for instance

Product.reindex
  # Check dashboard, all specified settings are disappeared.
  # Not only specified settings inside algoliasearch block, but manual setting on dashboard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant