Paginated search retrieves incomplete documents upon multiple filters
binjamil opened this issue ยท comments
The following code runs on each request for a specifc page
number:
const searchPaginatedData = await invoicesCollection.search(
{
q: '',
searchFields: [
"invoiceNumber",
"customer.customerName",
"customer.customerPhone",
],
filter: {
op: LogicalOperator.OR,
selectorFilters: [
{ status: "Fully Paid" },
{ status: "Partial Paid" },
{ status: "Unpaid" },
],
},
hitsPerPage: 5,
sort: { field: "createdAt", order: Order.DESC },
},
page
);
console.log("Hits count", searchPaginatedData.hits.length);
console.log(searchPaginatedData.meta);
Following are the console outputs for 3 requests, one for each page. The first request shows correct document/hits count, but the subsequent pages are missing data:
page = 1
All good as 5 documents retrieved for a page size of 5
Hits count 5
SearchMeta {
_found: 11,
_totalPages: 3,
_page: Page { _current: 1, _size: 5 },
_matchedFields: []
}
page = 2
Only 1 document retrieved when there should have been 5
Hits count 1
SearchMeta {
_found: 11,
_totalPages: 3,
_page: Page { _current: 2, _size: 5 },
_matchedFields: []
}
page = 3
Zero documents retrieved when there should have been 1
Hits count 0
SearchMeta {
_found: 11,
_totalPages: 3,
_page: Page { _current: 3, _size: 5 },
_matchedFields: []
}
Note: The issue only arises if I have more than one filters combined via logical OR. Seems to be working fine with a single filter or no filters
๐ This issue has been resolved in version 1.0.0-beta.57 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐
Hey @adilansari , is this fix thoroughly tested? I'm still facing the bug as it retrieves fewer rows when I search with multiple OR fields. Or perhaps the fix is not released on Tigris Cloud yet?
Hey @adilansari , is this fix thoroughly tested? I'm still facing the bug as it retrieves fewer rows when I search with multiple OR fields. Or perhaps the fix is not released on Tigris Cloud yet?
Will be deployed most likely tomorrow, I shall update this thread when its ready.
Thank you for reporting it!
@binjamil, the fix was not released to Tigris Cloud when you checked. It has been now. Let us know if you still see the issue.