Search 6 groundwork - Restore support for query result caching

Description

In Search 5, we used to have a cache in HSQuery, which would allow the query to not be re-executed when the user first gets the hits, then gets the total result size.

I'm not sure it's such a good idea to implement it in such a subtle way: users may want to execute query multiple times and get updated results, just like they would in ORM when outside of a transaction, or when executing in multiple different transactions. With this cache under the hood, they cannot do that, and more importantly they won't know they cannot until they try it and get frustrated.

A perhaps better solution may be to expose a method that returns a SearchResult (like we do in the backend SPIs). The SearchResult would contain everything the user asked for: hits, total result count, aggregations, facets, ... All consistent and retrieved within a single query.

Note that even if we expose such a method, getResultSize is still relevant for the user: it allows to retrieve just the result size, without the hits, facets, aggregations, ... So it can be considered as a lighter alternative.

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure