reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

ReactiveSearch: Total hits returns to default 10000 after 'size' props changes

Open allendol opened this issue 3 years ago • 3 comments

Affected Projects ReactiveSearch

Describe the bug I set defaultQuery as below defaultQuery={props => ({ track_total_hits: true })} Now I get the correct total hits which is more than default 10000, But when the 'size' property is changed in my ReactiveSearch code, defaultQuery doesn't work and total hits goes back 10000. I saw in other thread to pass ?rest_total_hits_as_int=true in request parameter. But I don't know how and where. Any sample code is appreciated.

To Reproduce <ReactiveList dataField="main_no" / componentId="Result01" react={{ and: ["Main No"], }} pagination={true} paginationAt="both" showResultStats={true} size={this.state.selectedRow.value} defaultQuery={() => { return { track_total_hits: true }; }} preserveResults={true} render={(this.state.selectedOption.value === 'eval') ? this.ReactiveList : this.ReactiveList2} onPageChange={ this.hideid } style={{ padding: "0.015625em", }} /> Steps to reproduce the behavior: Change the size from the interface Expected behavior Total number of results should not be changed to default value:10000

allendol avatar Apr 27 '22 15:04 allendol

This is clearly a bug. I added console.log and I see when the 'size' props changes, the code goes to below.

defaultQuery={props => ({ console.log("ReactiveList: defaultQuery");
track_total_hits: true })}

But track_total_hits: true is not executed:

allendol avatar Apr 27 '22 18:04 allendol

The issue cannot be reproduced. I have made a codesandbox where you can try changing the size by hitting the button. You would see that the size of the list gets bigger and the total results (26444) would remain the same.
The loom preview for demo is attached below. It shows the network requests which still track the total hits and doesn't get reset to default when changing size.

Loom preview CSB Link

SavvyShah avatar Jun 08 '22 08:06 SavvyShah

Hi, I also face it i.e. @SavvyShah I can definitely reproduce this bug.

https://user-images.githubusercontent.com/7634398/201034866-34448061-6674-43a2-a9e9-5c5369f7fb4f.mov

guma44 avatar Nov 10 '22 08:11 guma44