tigrisdata-archive / tigris

Tigris is an Open Source Serverless NoSQL Database and Search Platform.

Home Page:https://www.tigrisdata.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. 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: []
}
  1. 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: []
}
  1. 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.