9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/transactions/cortex/get_content_items_for_content_type_transaction.rb', line 9
def search(params)
tenant_id = params[:args][:tenant_id] || params[:active_tenant].id
content_type_id = params[:content_type].id
definition = Elasticsearch::DSL::Search.search {
query do
bool do
filter do
term tenant_id: tenant_id
end
filter do
term content_type_id: content_type_id
end
end
end
sort created_at: {
order: 'desc'
}
}
results = Cortex::ContentItem.search(definition, index: params[:content_type].content_items_index_name)
Success(results.records)
end
|