Hi, so far this channel has been very helpful. Tha...
# community-help
a
Hi, so far this channel has been very helpful. Thanks a lot. I need another suggestion regarding Query Suggestions. My site has a large number of pages and a global Search field/widget on top of each page. The requirement is to show popular/relevant search terms/query and actual results of different types in a drop-down list. Showing search result-as-you-type is not applicable for our use-case. What'd be the most effective approach to have meaningful query suggestions along with the categorized results? One solution comes to mind is to have a secondary index for queries submitted by the users. But this approach unreliable as someone can insert irrelevant/garbage queries in the index. So it does not seems suitable. Please suggest some standard Typesense solution. Please note that the search feature is very important as the website is a B2B enterprise eCommerce. So garbage/irrelevant suggestions won't be acceptable. Thanks!
j
We’ve added the ability for Typesense to track search queries natively if you want to give it a shot: https://gist.github.com/jasonbosco/0c49916fc2e7a54f30d961aac111cf4a
a
Thanks!
Our Typesense cluster version is of
v0.25.0.rc32
. If we upgrade to
0.25.0.rc52
, we'd get the extra collection Out-of-the-box. And we'd be able to query on this collection onward, right? Or should we also prepare the analytics rule first?
j
After the upgrade, you would have to first create the analytics collection, then setup the analytics rule, and then search terms will show up in the analytics collection you created
a
The analytics collection is missing some search teams. Is this somehow expected? Or Should I check something? And I don't think I have ever seen any documentation for the Analytics Rules. If there is any, could you please share the link?
Note - the following changes have been made. 1. We have upgraded the cluster to
v0.25.0.rc53
. 2. A new collection has been created with name
top_queries
3. A rule has been created as well.
Copy code
{
  "rules": [
    {
      "name": "top_queries",
      "params": {
        "destination": {
          "collection": "top_queries"
        },
        "limit": 1000,
        "source": {
          "collections": [
            "name_of_the_collection_containing_actual_data"
          ]
        }
      },
      "type": "popular_queries"
    }
  ]
}
Did I miss anything?
And is there any delay expected for the queries to show up in the analytics collection?
j
This is the only docs at the moment: https://typesense-community.slack.com/archives/C01P749MET0/p1689623051117489?thread_ts=1689584645.886149&cid=C01P749MET0 Could you DM me your cluster ID? I can check if everything was setup properly on our side
a
Sent it to your inbox. Please let me know if you need anything else. Thanks!
j
Looks like everything is setup correctly and I do see search terms being logged in your top queries collection…
There is a delay of 5 minutes between the time a query is typed and when it shows up in the top queries collection though… Could it be that?
a
According to my observations, some queries never show up in the top queries collection. Would you provide any details about the delay? I think sometimes queries show up almost instantly. Is it some kind of max delay?
j
Yeah, it’s a max delay. There’s a 5 minute timer that’s running and it aggregates all search terms in the last 5 minutes