Slackbot
10/09/2023, 4:33 PMJason Bosco
10/09/2023, 4:36 PManalytics-flush-interval and the aggregation key X-TYPESENSE-USER-ID.
We consider unique search terms after a 4 second delay after the last keypressJason Bosco
10/09/2023, 4:38 PMArad Alvand
10/09/2023, 4:40 PMX-TYPESENSE-USER-ID will "collapse" into one, so to speak? And is that collapsing limited to the duration of analytics-flush-interval? Meaning that if analytics-flush-interval is, like, 5 seconds, If the same user (with the same X-TYPESENSE-USER-ID ) sends the same query twice, once now, and once 10 seconds from now, that will increase the count by 2?Jason Bosco
10/09/2023, 4:44 PMX-TYPESENSE-USER-ID is used to group keypresses in a search-as-you-type experience.
So for eg, if the user types in term one letter at a time, the search queries will show up to Typesense as: t, te, ter, term...
Typesense will wait for 4s after the last query term for a given X-TYPESENSE-USER-ID and collapse the previous searches for `t, te and ter into term...Jason Bosco
10/09/2023, 4:45 PManalytics-flush-interval is actually independent from the the 4s interval. flush interval is when the collected analytics logs are analyzed and the aggregation I mentioned above is performed across all users, across all search termsJason Bosco
10/09/2023, 4:46 PMIf the same user (with the same X-TYPESENSE-USER-ID ) sends the same query twice, once now, and once 10 seconds from now, that will increase the count by 2?That's correct. But, this is actually not based on analytics-flush-interval like I mentioned earlier (my bad - I edited that out), but based on a fixed 4s window.
Jason Bosco
10/09/2023, 4:46 PMArad Alvand
10/09/2023, 4:57 PMcount of a query is incremented within N seconds/minutes/hours. So that, for example, even if there's a 1,000 requests for the same query within the span of 3 hours, all that just increments count by 1.
So I'll probably have to use a custom collection for this that my app populates on its own, according to whatever custom heuristics it may have (given all the requests to Typesense actually go through our backend, it shouldn't be too difficult to implement this,)
One last question: Is there a way to tell Typesense (e.g. via a query string parameter when sending a request to the search endpoint) that it should ignore that particular search in terms of analytics and not store its query in the queries collection?Jason Bosco
10/09/2023, 7:42 PMhaving a limit for the amount of times the count of a query is incremented within N seconds/minutes/hours.Typesense doesn't have this... But I think that will be a useful feature to support.
Is there a way to tell Typesense (e.g. via a query string parameter when sending a request to the search endpoint) that it should ignore that particular search in terms of analyticsThis is not possible at the moment, but I was thinking about this myself recently. Could you create two GitHub issues, so we can track these?
Arad Alvand
10/09/2023, 7:53 PM