如何在Python中将customRanking应用于从属服务器

2024-06-16 10:57:47 发布

您现在位置:Python中文网/ 问答频道 /正文

例如,在我的Django algolia设置中,我想添加具有特定排序的从属

   settings = {
       'attributesToIndex': index_fields,
       'slaves': ['Book_by_price_asc','Book_by_price_desc'],
   }

但我似乎找不到合适的方法来给奴隶增加一个等级

'customRanking': ['asc(book)'] and 'customRanking': ['desc(book)']。你知道吗

我希望能够在python中定义它,类似于algolia rails所支持的内容。你知道吗

add_slave 'Book_by_price_asc', per_environment: true do
  attributesToIndex [:name, :author, :editor]
  customRanking ['asc(price)']
end

这在python中是可能的吗?你知道吗

谢谢!你知道吗


Tags: djangofieldsindexbysettings排序pricedesc