#community-help

Hiding Exact Hits Number in Typesense and Utilizing `out_of` Field

TLDR A sought a way to hide exact hits count in Typesense. Kishore Nallan clarified about the out_of field, its future use, and suggested using found for scrolling. Jason offered a solution to hide the count by modifying the item template.

Powered by Struct AI
22
33mo
Solved
Join the chat
May 15, 2021 (33 months ago)
A
Photo of md5-98c72c3023867be0346b48ae4cb22001
A
11:23 AM
is there anyway to not show the exact amount of hits in typesense?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:24 AM
Are you talking about the out_of field in response?
A
Photo of md5-98c72c3023867be0346b48ae4cb22001
A
11:32 AM
11:32
A
11:32 AM
i used the algolia typesense adapters and it shows the number of hits
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:32 AM
This is the facet counts?
11:33
Kishore Nallan
11:33 AM
I'm not sure if the facet counts can be disabled. Jason can answer later.
A
Photo of md5-98c72c3023867be0346b48ae4cb22001
A
11:38 AM
ye this is facet counts. alright thank you
Stephano
Photo of md5-1b5a9819eb84d9342bdcd7da73258779
Stephano
12:12 PM
Is ‘out_of’ the total number of documents in the collection ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:13 PM
Correct. It's not documented at the moment. We've not decided if it is a useful number to expose in the response. We've concerns of privacy so will likely not have it in future.
Stephano
Photo of md5-1b5a9819eb84d9342bdcd7da73258779
Stephano
12:14 PM
Really useful. I was using it as total to know whether to request more hits for infinite scroll
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:15 PM
Oh cool. The primary worry I have is that reveals the size of your "inventory", which might not be ideal in certain contexts. Perhaps we should have a way to exclude it through the use of a parameter in the scoped API key, which will make it immutable to tampering.
12:16
Kishore Nallan
12:16 PM
Actually, the field to be used for scrolling will be found.
Stephano
Photo of md5-1b5a9819eb84d9342bdcd7da73258779
Stephano
12:17 PM
We just check if number per page * page >= total in order to decide whether to make a new request
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:19 PM
But a query might not match all documents in a collection. So, found is the correct number to use.
12:20
Kishore Nallan
12:20 PM
out_of returns total number of documents in collection.
Stephano
Photo of md5-1b5a9819eb84d9342bdcd7da73258779
Stephano
12:20 PM
Oh exactly, yeah I see
12:20
Stephano
12:20 PM
Does found apply to *
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:22 PM
Yes, it will return same number as out_of in that case.
Stephano
Photo of md5-1b5a9819eb84d9342bdcd7da73258779
Stephano
12:22 PM
Right, thanks man 🙏:skin-tone-3:
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:22 PM
:thumbsup:
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:23 PM
A you can customize the display of each item in the refinementList using the template parameter: https://www.algolia.com/doc/api-reference/widgets/refinement-list/js/#widget-param-item

And you can hide the count by removing it from the item template
May 17, 2021 (33 months ago)
A
Photo of md5-98c72c3023867be0346b48ae4cb22001
A
05:21 AM
thank you!

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3005 threads (79% resolved)

Join Our Community

Similar Threads

Resolve Facets and Sorting Issues with Typesense

Ethan needed assistance with getting all facet values and sorting results by date using Typesense. Jason provided guidance on how to use Typesense properties to accomplish these tasks, and resolved issues related to specific use-cases provided by Ethan and Rushil.

11

70
4mo
Solved

Range Filtering and Faceting Discussion

Phil asked about the requirements for range filtering, which Jason explained does not always require faceting. Discussion about different possibilities with Algolia and Typesense ensued, resulting in Phil successfully utilizing the 'Configure' widget.

2

48
28mo
Solved

Querying with Typesense-Js and Handling Null Values

michtio was querying using typesense-js and receiving fewer results than expected. Kishore Nallan suggested using different query parameters. Further discussion led to the handling of 'null' values and filtering syntax in the search queries. The thread ended with Jason offering migration support from Algolia to Typesense.

4

39
17mo
Solved

Typesense Products Filtering Issue with Mixed AND+OR Filtering

Dmytro faced issues in implementing mixed AND+OR filtering for product filtering on Typesense using `'typesense-instantsearch-adapter'` despite using several approaches and facets. Jason suggested increasing the number of facets fetched and trying a different server version but the issue remains.

8
18mo

Understanding and Implementing Typesense Dart Library with Flutter

Alexandro sought help with the Typesense Dart library. Jason explained that the library is in progress, discussed utilizing other HTTP libraries, and provided detailed instructions on utilizing Typesense with Flutter. Alexandro provided feedback on the Typesense UI and expressed interest in creating a tutorial video.

10

82
32mo