Hey all, I have a question, I've added a "popular_...
# community-help
m
Hey all, I have a question, I've added a "popular_queries" analytics rule, from a collection, feeding it into another, this is setup correctly, but seems like all I get in my "popular search query" is the following:
Copy code
q
*
count
730
 
text_match_info
best_field_score
0
best_field_weight
12
fields_matched
4
num_tokens_dropped
1
score
100
tokens_matched
0
typo_prefix_score
255
id
11421815545832784468
It seems like everyone searches for
"*"
even tho I expect this to be there (as this is the query entered on page load) - but I'd expect some search terms in there as well? Or is there a specific treshold we need to pass before they enter in there?
as additional context, I only made the schema with what the docs suggest:
Copy code
let schema = {
  "name": "product_queries",
  "fields": [
    {"name": "q", "type": "string" },
    {"name": "count", "type": "int32" }
  ]
}
I did not add anything else.
Because I couldn't edit:
Copy code
{
  "document": {
    "count": 1102,
    "id": "11421815545832784468",
    "q": "*"
  },
  "highlight": {},
  "highlights": [],
  "text_match": 100,
  "text_match_info": {
    "best_field_score": "0",
    "best_field_weight": 12,
    "fields_matched": 4,
    "num_tokens_dropped": 1,
    "score": "100",
    "tokens_matched": 0,
    "typo_prefix_score": 255
  }
}
This is the only thing I'm getting in my analytics collection.
We do a multiSearch as follows tho:
Copy code
searches: [
                    {
                        collection: this.index,
                        exclude_fields: "embedding",
                        facet_by: 'sector,contract_type,work_regime,city,post_code',
                        hidden_hits: this.filters.hidden_hits,
                        filter_by: this.filters.filterQuery,
                        page: this.pagination.current,
                        per_page: this.pagination.itemsPerPage,
                        q: this.filters.searchQuery || '*',
                        query_by: "title,description,reference", //embedding
                        max_facet_values: 100,
                        sort_by: (this.filters.searchQuery !== '' && this.filters.location.value !== '') ? `_text_match:desc,coordinates(${this.filters.location.value}):asc` : `${this.sorting.type}:${this.sorting.order}`, //_vector_distance:asc
                    },
                    {
                        collection: this.index,
                        facet_by: "sector,contract_type,work_regime",
                        page: 1,
                        per_page: 1,
                        max_facet_values: 100,
                        q: "*",
                        sort_by: "_text_match:desc",
                    },
                ]
The second part is to make sure we always have all facet values. And it's necessary in our setup, can we filter for example
'*'
or that second search out of the analytics?
Maybe @Jason Bosco or @Kishore Nallan you can chime in. Basically we want to only give the actual search terms entered into our index.
But I'm currently just assuming this multiSearch might overwrite the
q
param 🤔
j
We don't have a way to filter out the
q: *
queries during query aggregation. You would have to do that when you query the destination collection, using a filter_by. But if you're seeing
q: *
being written into the destination collection, then that means the aggregation is working. Could you manually send a search with a specific q value, wait for the analytics flush interval period (5 mins on Typesense Cloud) and then check the collection again?
m
@Jason Bosco yes did that, but the query doesn't seem to aggregate those, I keep only getting the above - which is now at 7013 on
'*'
I'm not seeing any other values whatsoever. Hence why I'm thinking in a multiSearch approach, the second "fixes"
q: "*"
seems to overwrite the one in the initial index.
We use that second one, on
facet_by
to simply at all times have all the values to filter on.
j
May I know what version of Typesense this is on?
m
It's on 0.26.0 - Typesense cloud on the following Cluster: ai80e5x2617k9rpzp
j
We've fixed a couple of issues with analytics tracking in recent versions of Typesense. Could you try this on
v28.0.rc35
?
m
How stable is it @Jason Bosco? If it's stable feel free to update our cluster to 28 rc35 🙂
f
You can update it yourself in the
Manage Cluster
page inside Typesense Cloud. Also, it's as stable as can be, it's the last release candidate before our upcoming
v28
release
m
@Fanis Tharropoulos thanks, let me push that button 😉