Skip to content

Allow SearchService#search_state to be mutated#3841

Open
jcoyne wants to merge 1 commit into
mainfrom
jcoyne-patch-3
Open

Allow SearchService#search_state to be mutated#3841
jcoyne wants to merge 1 commit into
mainfrom
jcoyne-patch-3

Conversation

@jcoyne
Copy link
Copy Markdown
Member

@jcoyne jcoyne commented May 22, 2026

This allows us to adjust the search_state and run a query again, without having to reinitialize the object.

This can be used in a report where you may want to iterate through a bunch of pages of results to construct a CSV.

This allows us to adjust the search_state and run a query again, without having to reinitialize the object.  

This can be used in a report where you may want to iterate through a bunch of pages of results to construct a CSV.
@cbeer
Copy link
Copy Markdown
Member

cbeer commented May 22, 2026

I find mutating search_state pretty surprising. I wonder if updating search_results to accept either a search_state or the search_builder would get you there?

@tpendragon
Copy link
Copy Markdown
Member

@jcoyne Can you speak to the use case motivating wanting to do this? Like is a user asking for something and this makes that feature easier?

@jcoyne
Copy link
Copy Markdown
Member Author

jcoyne commented May 22, 2026

@tpendragon I was thinking of paging through a result set to write a report.

So, initialize the SearchService once, then call search_results, update the page in the search_state, then call search_results again, repeat until done.

In the existing code, I have to have a different SearchService instance for each page of results.

@jcoyne
Copy link
Copy Markdown
Member Author

jcoyne commented May 22, 2026

I find mutating search_state pretty surprising. I wonder if updating search_results to accept either a search_state or the search_builder would get you there?

@cbeer yes, I think that approach would work just as well.

@jrochkind
Copy link
Copy Markdown
Member

Do we need a new test ensuring as supported tested API? I approved anyway, up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants