lib/scrivito/backend/obj_query.rb in scrivito_sdk-1.0.0 vs lib/scrivito/backend/obj_query.rb in scrivito_sdk-1.1.0.rc1
- old
+ new
@@ -26,21 +26,21 @@
if missing_keys.blank?
return load_nested_ids(revision, ids_from_cache)
end
- backend_ids = revision.obj_search_request(index.query(missing_keys))
+ backend_ids, tentative = revision.obj_search_request(index.query(missing_keys))
all_obj_datas = load_nested_ids(revision, ids_from_cache + [backend_ids])
cache_obj_datas = all_obj_datas[0..-2]
backend_obj_datas = all_obj_datas.last
grouped_backend_results = index.group_by(missing_keys, backend_obj_datas)
grouped_backend_results.each_with_index do |result, i|
ids = result.map { |obj_data| obj_data.value_of("_id") }
- cache.write_index(index.id, missing_keys[i], ids)
+ cache.write_index(index.id, missing_keys[i], ids, persistent: !tentative)
end
cache_obj_datas.map do |obj_datas|
obj_datas || grouped_backend_results.shift
end