Sometimes you can return filter_count, sometimes you can't.
let searchkey = ""
let categories = ""
this.client.getItems("blog",{
meta:"total_count,result_count,filter_count",
sort: "-created_on",
filter:{
"category.id": {
in: category
},
title:{
logical: "or",
contains: searchkey
},
description:{
logical: "or",
contains: searchkey
},
},
limit: 10,
fields: "*.*",
status: "published"
})
At this point, because searchkey and categories are empty, no filter is passed, and filter_count cannot be returned.


let searchkey = ""
let categories = "7,13,15,8,14,32"
this.client.getItems("blog",{
meta:"total_count,result_count,filter_count",
sort: "-created_on",
filter:{
"category.id": {
in: category
},
title:{
logical: "or",
contains: searchkey
},
description:{
logical: "or",
contains: searchkey
},
},
limit: 10,
fields: "*.*",
status: "published"
})
At this point, because the search key is empty and the categories have a value, the filter [category. id] [in]: 7, 13, 15, 8, 14, 32 is passed, and the filter_count is returned correctly.


let searchkey = ""
let categories = "28,29,30"
this.client.getItems("blog",{
meta:"total_count,result_count,filter_count",
sort: "-created_on",
filter:{
"category.id": {
in: category
},
title:{
logical: "or",
contains: searchkey
},
description:{
logical: "or",
contains: searchkey
},
},
limit: 10,
fields: "*.*",
status: "published"
})
The filter [category. id] [in]: 7, 13, 15, 8, 14, 32 is passed, and no data is returned after filtering, so filter_count cannot be returned at this time.


master branch]I'm doing this now, but it's not a good solution.
let searchkey = "", categories = "", page = 1, pagesize = 10, sort = '-created_on'
this.client.getItems("blog",{
meta:"total_count,result_count,filter_count",
sort: sort,
filter:{
"category.id": {
in: category
},
title:{
logical: "or",
contains: searchkey
},
description:{
logical: "or",
contains: searchkey
},
},
offset: page * pagesize - pagesize,
limit: pagesize,
fields: "*.*",
status: "published"
}).then((res) => {
let filter_total = 0
if(res.meta.result_count === 0){
filter_total = 0
}else if(res.meta.result_count > 0){
if(res.meta.filter_count){
filter_total = res.meta.filter_count
}else {
filter_total = res.meta.total_count
}
}
this.total = filter_total
})
Fixed in #1088
Fixed in #1088
Thank you very much :+1::+1::+1:
Most helpful comment
Fixed in #1088