paradedb
paradedb copied to clipboard
Add "hits total" value to search result
What During a search, there is always a hit counter with the number of records found. Even if you use limit or offset. This hit counter does not yet exist for "pg_search".
Why To display the number of hits found despite the limit or offset without having to do a second query. Otherwise, this will cost performance.
How Add the count value as a field value so that it can be retrieved if needed. By default, Elasticsearch returns the number of documents found in the response to a search query. This value is located under the hits.total.value key. We also need this value for pg_search. In any form.